結果
| 問題 |
No.339 何人が回答したのか
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2016-01-29 22:41:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 387 bytes |
| コンパイル時間 | 549 ms |
| コンパイル使用メモリ | 55,648 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-21 18:22:44 |
| 合計ジャッジ時間 | 2,019 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#include <iostream>
#include <sstream>
#include <numeric>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main(int argc, char *argv[])
{
int N, A[100], G, ans = 0;
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> A[i];
G = (i == 0) ? A[i] : gcd(A[i], G);
}
for (int i = 0; i < N; ++i) {
ans += A[i] / G;
}
cout << ans << endl;
return 0;
}
hotpepsi