結果
問題 | No.1389 Clumsy Calculation |
ユーザー |
|
提出日時 | 2021-02-12 21:35:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 1,545 ms |
コンパイル使用メモリ | 168,880 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 20:33:45 |
合計ジャッジ時間 | 3,879 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define _GLIBCXX_DEBUG#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)#define ll long longint main(){int n, x;cin >> n >> x;vector<int> s(n);vector<int> a(n);rep(i, n){cin >> s[i];a[i] = x - s[i];}int s2 = 0;rep(i, n) s2 += a[i];rep(i, n) {if (x - s2 == s[i]/2){cout << s[i]/2 << endl;return 0;}}}