結果
| 問題 | No.257 N言っちゃダメゲーム (3) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-26 03:32:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 76 ms / 2,000 ms |
| コード長 | 378 bytes |
| 記録 | |
| コンパイル時間 | 1,974 ms |
| コンパイル使用メモリ | 190,372 KB |
| 最終ジャッジ日時 | 2025-01-10 01:48:49 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | int n,k; scanf("%d%d",&n,&k);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:14:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | int x; scanf("%d",&x);
| ~~~~~^~~~~~~~~
main.cpp:22:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | int x; scanf("%d",&x);
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
int n,k; scanf("%d%d",&n,&k);
int p=0;
if((n-1)%(k+1)==0){ // 後攻
puts("0");
fflush(stdout);
int x; scanf("%d",&x);
p+=x;
}
while(1){
p+=(n-1-p)%(k+1);
printf("%d\n",p);
fflush(stdout);
int x; scanf("%d",&x);
if(x>=n) break;
p=x;
}
return 0;
}