結果

問題 No.305 鍵(2)
ユーザー fura
提出日時 2020-04-27 05:07:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 194,556 KB
最終ジャッジ日時 2025-01-10 02:26:51
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int ask(int*)’:
main.cpp:14:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         int x; scanf("%d%*s",&x);
      |                ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

random_device seed_gen;
mt19937 rng(seed_gen());

int ask(int* a){
	rep(i,10) printf("%d",a[i]);
	puts("");
	fflush(stdout);
	int x; scanf("%d%*s",&x);
	return x;
}

int main(){
	int a[10];
	do{
		rep(i,10) a[i]=rng()%10;
	}while(ask(a)!=0);

	rep(i,10){
		rep(d,10){
			a[i]=d;
			if(ask(a)==i+1) break;
		}
	}

	return 0;
}
0