結果
| 問題 |
No.1187 皇帝ペンギン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-06 20:22:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 368 bytes |
| コンパイル時間 | 1,699 ms |
| コンパイル使用メモリ | 191,508 KB |
| 最終ジャッジ日時 | 2025-01-14 08:01:13 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 54 |
コンパイルメッセージ
main.cpp: In function ‘bool ask(int)’:
main.cpp:10:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | char s[8]; scanf("%s",s);
| ~~~~~^~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
bool ask(int x){
printf("? %d\n",x);
fflush(stdout);
char s[8]; scanf("%s",s);
return s[0]=='s';
}
int main(){
int lo=0,hi=500;
while(hi-lo>1){
int mi=(lo+hi)/2;
if(ask(2*mi) || ask(2*mi+1)) lo=mi; else hi=mi;
}
printf("%d\n",ask(2*lo+1)?2*lo+1:2*lo);
return 0;
}