結果
| 問題 |
No.304 鍵(1)
|
| コンテスト | |
| ユーザー |
mag
|
| 提出日時 | 2020-09-14 07:48:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,137 bytes |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 68,940 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2024-07-17 06:58:20 |
| 合計ジャッジ時間 | 2,970 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 6 |
ソースコード
#include <iostream>
#include <fstream>
#include <cassert>
using namespace std;
string input(istream& is){
string ret;
getline(is, ret); //回答コードから受け取った文字列
assert(ret.size() == 3); //長さは 3
for(char c : ret){ //数字のみかチェック
assert('0' <= c && c <= '9');
}
return ret;
}
int main(int argc, char* argv[]){
ifstream ifs(argv[1]);
string ans = input(ifs); //第一引数のファイルから正解の文字列を取得
cerr << "Answer : " << ans << endl;
while(1){
string in = input(cin); //標準入力から回答の文字列を取得
if(in == ans){ //正解なら "unlocked" を出力して終了
cout << "unlocked" << endl;
if(getline(cin,in)){ //余計な出力がないか確認
cerr << "Wrong Answer : too many outputs, \"" << in << "\"" << endl;
abort();
}
return 0;
}else{ //不正解なら "locked" を出力
cout << "locked" << endl;
}
}
return 0;
}
mag