結果
| 問題 |
No.339 何人が回答したのか
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-01-29 22:49:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 455 bytes |
| コンパイル時間 | 603 ms |
| コンパイル使用メモリ | 66,692 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-21 18:26:30 |
| 合計ジャッジ時間 | 2,415 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
int n;
cin >> n;
int gcd;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (n == 1) {
cout << 1 << endl;
return 0;
}
gcd = __gcd(a[0], a[1]);
for (int i = 2; i < n; i++) {
gcd = __gcd(gcd, a[i]);
}
int ans = accumulate(a.begin(), a.end(), 0) / gcd;
cout << ans << endl;
return 0;
}