結果
| 問題 |
No.1389 Clumsy Calculation
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2021-02-12 21:48:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 718 bytes |
| コンパイル時間 | 1,051 ms |
| コンパイル使用メモリ | 91,148 KB |
| 最終ジャッジ日時 | 2025-01-18 18:20:16 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, x;
cin >> n >> x;
vector<int> s(n);
ll t = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
t += s[i];
}
for (int i = 0; i < n; i++) {
if (s[i] % 2 == 0) {
ll u = t - s[i] / 2;
if (u % (n - 1) == 0) {
u /= n - 1;
if (u == x) {
cout << s[i] / 2 << endl;
exit(0);
}
}
}
}
return 0;
}
merom686