結果
問題 |
No.257 N言っちゃダメゲーム (3)
|
ユーザー |
|
提出日時 | 2018-05-03 22:18:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 64,548 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 1.00 |
最終ジャッジ日時 | 2024-07-16 15:47:14 |
合計ジャッジ時間 | 4,091 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 28 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:7:10: warning: 'n' is used uninitialized [-Wuninitialized] 7 | if((n-1)%(k+1) == 0){ | ~~^~~ main.cpp:5:9: note: 'n' was declared here 5 | int n, k, my = 0, enemy; | ^ main.cpp:7:16: warning: 'k' is used uninitialized [-Wuninitialized] 7 | if((n-1)%(k+1) == 0){ | ~~^~~ main.cpp:5:12: note: 'k' was declared here 5 | int n, k, my = 0, enemy; | ^
ソースコード
#include<iostream> using namespace std; int main(){ int n, k, my = 0, enemy; if((n-1)%(k+1) == 0){ cout << 0 << endl << flush; }else{ my = (n-1)%(k+1); cout << my << endl << flush; } while(1){ cin >> enemy; if(enemy >= n) break; my += k+1; cout << my << endl << flush; } return 0; }