結果
| 問題 | No.339 何人が回答したのか |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-06 19:58:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 387 bytes |
| コンパイル時間 | 1,374 ms |
| コンパイル使用メモリ | 157,632 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 20:52:47 |
| 合計ジャッジ時間 | 3,018 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | int n; scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 1;
int a[MAXN];
int main(){
int n; scanf("%d", &n);
for(int i = 0; i < n; ++i)
scanf("%d", &a[i]);
int gcd = a[0];
for(int i = 1; i < n; ++i)
gcd = __gcd( gcd, a[i] );
int ans = 0;
for(int i = 0; i < n; ++i)
ans += a[i] / gcd;
printf("%d\n", ans);
return 0;
}