結果
問題 |
No.257 N言っちゃダメゲーム (3)
|
ユーザー |
![]() |
提出日時 | 2015-08-01 11:07:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 637 ms |
コンパイル使用メモリ | 55,392 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 3.70 |
最終ジャッジ日時 | 2024-07-16 21:02:51 |
合計ジャッジ時間 | 4,398 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int n,k;scanf("%d%d",&n,&k); | ~~~~~^~~~~~~~~~~~~~ main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d",&now); | ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <algorithm> #include <iostream> using namespace std; //namaega184 int main(){ int n,k;scanf("%d%d",&n,&k); int now=0,d=k+1-(n-1)%(k+1); int dis=(now+d)%(k+1); if(dis)now+=k+1-dis; printf("%d\n",now); fflush(stdout); while(1 ){ scanf("%d",&now); if(now>=n)break; dis=(now+d)%(k+1); now+=k+1-dis; printf("%d\n",now); fflush(stdout); } return 0; }