結果
問題 |
No.339 何人が回答したのか
|
ユーザー |
![]() |
提出日時 | 2017-03-11 15:05:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 1,384 ms |
コンパイル使用メモリ | 161,760 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 12:06:14 |
合計ジャッジ時間 | 3,075 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define INF 2000000000 #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { int n; cin >> n; int a[n]; int b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a+n); bool ok = true; for (int i = 0; i < n; i++) { if (a[i]%a[0]==0) { b[i] = a[i]/a[0]; } else { ok = false; break; } } int ret = 0; if (ok) { ret = accumulate(b,b+n,0); } else { ret = accumulate(a,a+n,0); } cout << ret << endl; }