結果
問題 | No.253 ロウソクの長さ |
ユーザー |
![]() |
提出日時 | 2015-07-25 02:25:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 378 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 40,240 KB |
最終ジャッジ日時 | 2024-07-16 20:51:26 |
合計ジャッジ時間 | 6,759 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d", &ans0); | ~~~~~^~~~~~~~~~~~~ main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &ans1); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h>int main(void) {int i, ask = (1 << 30), ans0, ans1 = -1, y;for(i = 29; 0 <= i; i--) {printf("? %d\n", 1);scanf("%d", &ans0);if(ans0 != 1) {y = 2 * i + (ans0 == 0);break;}ask += ans1 * (1 << i);printf("? %d\n", ask - (2 * i + 1) );scanf("%d", &ans1);if(ans1 == 0) {y = ask;}}printf("! %d\n", y);return 0;}