結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー 184
提出日時 2015-07-31 23:32:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 434 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 57,116 KB
実行使用メモリ 25,844 KB
平均クエリ数 2.63
最終ジャッジ日時 2024-07-16 05:20:30
合計ジャッジ時間 3,553 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |                 int ret;scanf("%d",&ret);
      |                         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#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=n%(k+2);
	int dis=(now-d+k+2)%(k+2);
	if(dis)now+=k+1-dis;
	printf("%d\n",now);
	fflush(stdout);
	while(1){ 
		int ret;scanf("%d",&ret);
		if(ret>=n)break;
		now+=ret;
		dis=(now-d+k+2)%(k+2);
		now+=k+1-dis;
		printf("%d\n",now);
		fflush(stdout);
	}
	return 0;
}
0