結果
| 問題 |
No.257 N言っちゃダメゲーム (3)
|
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2015-07-31 22:55:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 312 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 3.77 |
| 最終ジャッジ日時 | 2024-07-16 20:56:13 |
| 合計ジャッジ時間 | 3,407 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d%d", &n, &k);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &v);
| ~~~~~^~~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d", &v);
| ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void) {
int n, k;
scanf("%d%d", &n, &k);
int v = 0;
if(n % (k + 1) == 1) {
printf("0\n"); fflush(stdout);
scanf("%d", &v);
}
do {
printf("%d\n", ((n - v) % (k + 1) ? v + ((n - v) % (k + 1) - 1) : v + k) ); fflush(stdout);
scanf("%d", &v);
} while(v < n);
return 0;
}
FF256grhy