結果

問題 No.305 鍵(2)
コンテスト
ユーザー LatteIce
提出日時 2015-11-27 23:40:25
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 762 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 417 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 44,096 KB
最終ジャッジ日時 2026-03-31 11:06:40
合計ジャッジ時間 6,773 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef unsigned int uint;
typedef unsigned long ulong;

int main() {
	int count = 0;
	int number[10] = { 0 };
	int answer = 0;
	int targetmask = 1;
	int responce1 = 0;
	string responce2;
	int lastnumber = 0;

	while (true) {
		printf("%010d\n", answer);
		cin >> responce1 >> responce2;
		if (responce2 == "unlocked") {
			return 0;
		}
		else {
			if (responce1 < lastnumber) {
				answer -= targetmask;
				targetmask *= 10;
				lastnumber = responce1 + 1;
			}
			else if (responce1 > lastnumber) {
				targetmask *= 10;
				lastnumber = responce1;
			}
			else {
				lastnumber = responce1;
			}
			answer += targetmask;
		}
	}

	return 0;
}
0