結果
問題 | No.305 鍵(2) |
ユーザー |
![]() |
提出日時 | 2017-01-18 00:59:18 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 466 bytes |
コンパイル時間 | 271 ms |
コンパイル使用メモリ | 22,272 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 58.77 |
最終ジャッジ日時 | 2024-07-17 00:44:57 |
合計ジャッジ時間 | 1,657 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
main.c: In function ‘try’: main.c:10:20: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int *’ [-Wformat=] 10 | scanf("%d %s", &x, s); | ~^ ~ | | | | char * int * | %ls main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d %s", &x, s); | ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #define rep(i, n) for (i = 0; i < n; i++) int try(int *t) { int i, x, s[9]; rep(i, 10) printf("%d", t[i] % 10); printf("\n"); fflush(stdout); scanf("%d %s", &x, s); if (x == 10) exit(0); return x; } int main() { int i, j, r[10]; rep(i, 10) r[i] = rand() % 10; int x = try(r); rep(i, 10) { int t = x = try(r); rep(j, 10) { r[i]++; x = try(r); if (x > t) break; if (x < t) { r[i]--; break; } } } }