結果

問題 No.305 鍵(2)
ユーザー kimaguremankimagureman
提出日時 2016-02-08 01:52:43
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 687 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 61,180 KB
実行使用メモリ 23,808 KB
平均クエリ数 6.54
最終ジャッジ日時 2023-09-23 23:08:43
合計ジャッジ時間 4,082 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,424 KB
testcase_01 AC 26 ms
23,376 KB
testcase_02 AC 24 ms
23,808 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define KEYOUT for(int i=0; i<10; ++i) {cout << key[i];} cout << endl

int main(int argc, char** argv)
{
	int key[10];
	for (int ii=0; ii<10; ++ii) {
		key[ii] = (ii+1)%10;
	}
	KEYOUT;
	int match = 0;
	int sidx  = -1;

	do {
		int n;
		string stt;
		cin >> n >> stt;
		if (n==10) {
			break;
		}
		if (n==0) {
			for(int ii=0; ii<10; ++ii) key[ii] = (key[ii]+1) % 10;
			KEYOUT;
			continue;
		}
		if (n>match) {
			match = n;
			++ sidx;
		}
		else if (n<match) {
			key[sidx] = key[sidx]-1>=0 ? key[sidx]-1 : 9;
			++ sidx;
		}
		key[sidx] = (key[sidx]+1) % 10;
		KEYOUT;

	} while(true);

	return 0;
}
0