結果
| 問題 | No.257 N言っちゃダメゲーム (3) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-26 03:34:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 333 bytes |
| 記録 | |
| コンパイル時間 | 2,222 ms |
| コンパイル使用メモリ | 190,360 KB |
| 最終ジャッジ日時 | 2025-01-10 01:49:06 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d",&p);
| ~~~~~^~~~~~~~~
main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%d",&p);
| ~~~~~^~~~~~~~~
ソースコード
#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);
scanf("%d",&p);
}
while(p<n){
p+=(n-1-p)%(k+1);
printf("%d\n",p);
fflush(stdout);
scanf("%d",&p);
}
return 0;
}