結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
LayCurse
|
| 提出日時 | 2016-04-01 22:27:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 1,034 bytes |
| コンパイル時間 | 1,467 ms |
| コンパイル使用メモリ | 159,124 KB |
| 実行使用メモリ | 25,592 KB |
| 平均クエリ数 | 5.31 |
| 最終ジャッジ日時 | 2024-07-16 23:08:08 |
| 合計ジャッジ時間 | 4,969 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
34 | scanf("%d%d",&x,&y);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
char memarr[17000000]; void *mem = memarr;
#define MD 1000000007
int ok[10][10][10][10];
int main(){
int i, j, k, l, x, y, s, t;
int a, b, c, d;
int use[10];
rep(a,10) rep(b,10) rep(c,10) rep(d,10){
if(a!=b && a!=c && a!=d && b!=c && b!=d && c!=d) ok[a][b][c][d] = 1;
}
for(;;){
for(;;){
a=rand()%10;
b=rand()%10;
c=rand()%10;
d=rand()%10;
if(ok[a][b][c][d]) break;
}
printf("%d %d %d %d\n",a,b,c,d);
fflush(stdout);
scanf("%d%d",&x,&y);
if(x==4) break;
rep(i,10) use[i] = 0;
use[a] = use[b] = use[c] = use[d] = 1;
rep(i,10) rep(j,10) rep(k,10) rep(l,10) if(ok[i][j][k][l]){
s = 0;
if(i==a) s++;
if(j==b) s++;
if(k==c) s++;
if(l==d) s++;
t = use[i] + use[j] + use[k] + use[l] - s;
if(s!=x || t!=y) ok[i][j][k][l] = 0;
}
}
return 0;
}
LayCurse