結果
問題 |
No.246 質問と回答
|
ユーザー |
![]() |
提出日時 | 2015-07-17 23:07:07 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 132 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 42,100 KB |
最終ジャッジ日時 | 2024-07-16 19:44:27 |
合計ジャッジ時間 | 6,555 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 29 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:25:9: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=] 25 | scanf("%d",ans); | ~^ ~~~ | | | | | int | int * main.c:12:2: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&ans); | ^~~~~~~~~~~~~~~~ main.c:25:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d",ans); | ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void){ int low=1; int high=1000000000; while(low+1<high){ int m=(low+high)/2; printf("? %d\n",m); int ans; scanf("%d",&ans); if(ans){ low=m; } else { high=m; } } if(high==low){ printf("! %d\n",low); return 0; } printf("? %d\n",high); int ans; scanf("%d",ans); if(ans){ printf("!%d\n",high); } else { printf("%d\n",low); } return 0; }