結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-11-30 00:25:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 542 bytes |
| コンパイル時間 | 477 ms |
| コンパイル使用メモリ | 60,332 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 63.08 |
| 最終ジャッジ日時 | 2024-07-16 08:01:17 |
| 合計ジャッジ時間 | 2,143 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int getres(const char*)’:
main.cpp:12:14: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | fgets(buff, 1024, stdin);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
using namespace std;
int getres(const char *w) {
printf("%s\n", w);
fflush(stdout);
char buff[1024];
fgets(buff, 1024, stdin);
return atoi(buff);
}
int main(int argc, char *argv[])
{
char w[16] = "0000000000";
int a = getres(w);
for (int i = 0; i < 10; ++i) {
for (int j = 0; j < 10; ++j) {
w[i] = '0' + j;
int b = getres(w);
if (b < a) {
w[i] = '0' + j - 1;
break;
}
if (b > a) {
a = b;
break;
}
}
}
return 0;
}
hotpepsi