結果
問題 |
No.339 何人が回答したのか
|
ユーザー |
![]() |
提出日時 | 2016-03-04 12:21:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 396 ms |
コンパイル使用メモリ | 56,164 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 14:02:37 |
合計ジャッジ時間 | 1,859 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:18: warning: ‘gcdkeep’ may be used uninitialized in this function [-Wmaybe-uninitialized] 19 | cout << 100 / gcdkeep << endl; | ^~~~~~~
ソースコード
#include <iostream> using namespace std; int gcd(int x,int y){ while(x != y){ if(x > y) x -= y; else y -= x; } return x; } int main(){ int gcdkeep,n; cin >> n; for(int a,i = 0;i < n && cin >> a;i++){ if(i == 0) gcdkeep = a; gcdkeep = gcd(gcdkeep,a); } cout << 100 / gcdkeep << endl; }