結果
問題 | No.136 Yet Another GCD Problem |
ユーザー |
|
提出日時 | 2016-07-27 07:24:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 249 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 55,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 17:20:47 |
合計ジャッジ時間 | 2,300 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:9: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 18 | cout<<x<<endl; | ^
ソースコード
#include <iostream> using namespace std; int main(){ int n,k; cin>>n>>k; if(n%2==0){ cout<<n/2<<endl; return 0; } int x; for(int i=n-1; i>0; --i){ if(n%i==0){ x=i; break; } } cout<<x<<endl; return 0; }