結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2016-05-07 12:48:46 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,291 bytes |
コンパイル時間 | 526 ms |
コンパイル使用メモリ | 22,272 KB |
実行使用メモリ | 39,076 KB |
最終ジャッジ日時 | 2024-07-16 23:41:21 |
合計ジャッジ時間 | 6,647 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 51 |
コンパイルメッセージ
main.c: In function ‘perm’: main.c:11:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d %d", &x, &y); | ^~~~~~~~~~~~~~~~~~~~~~ main.c: In function ‘main’: main.c:40:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 40 | scanf("%d %d", &x, &y); | ^~~~~~~~~~~~~~~~~~~~~~ main.c:53:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 53 | scanf("%d %d", &x, &y); | ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int b[4], p[4], p2[4], used[4], f=0; void perm( int node) { if( node == 4 ) { if( !f ) { int i, x, y; printf("%d %d %d %d\n", b[ p[0] ], b[ p[1] ], b[ p[2] ], b[ p[3] ]); scanf("%d %d", &x, &y); if( x == 4 ) { f = 1; int j; for( j = 0; j < 4; j++) { p2[j] = p[j]; } } } } else { int i; for( i = 0; i < 4; i++) { if( !used[i] ) { used[i] = 1; p[node] = i; perm(node+1); used[i] = 0; } } } } int main(void) { int i, j, k, a[4]={9,0,1,2}, x, y, xy=0, bxy=0, bcnt=0; while( bcnt != 4) { printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]); scanf("%d %d", &x, &y); xy = x+y; for( j = 0; j < bcnt; j++) { for( k = 0; k < 4; k++) if( a[k] == b[j] ) xy--; } int cnt = 0, s[10]={}; while( cnt < 10 ) { for( i = 0; i < 4; i++) { a[i] = (cnt+i) % 10; } printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]); scanf("%d %d", &x, &y); bxy = xy; xy = x+y; for( j = 0; j < bcnt; j++) { for( k = 0; k < 4; k++) if( a[k] == b[j] ) xy--; } if( xy > bxy ) { s[ (cnt+3) % 10] = 1; } else if( xy < bxy ) { s[ (cnt+9) % 10] = 1; } cnt++; } for( i = 0; i < 10; i++) { if( s[i] ) { b[bcnt] = i; bcnt++; } } } perm(0); return 0; }