結果

問題 No.305 鍵(2)
ユーザー kimaguremankimagureman
提出日時 2016-02-08 01:39:23
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 707 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 62,928 KB
実行使用メモリ 24,036 KB
平均クエリ数 432.23
最終ジャッジ日時 2023-09-23 08:51:31
合計ジャッジ時間 5,954 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 24 ms
23,424 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 27 ms
23,556 KB
testcase_06 AC 27 ms
23,424 KB
testcase_07 TLE -
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];
	int fix[10];
	for (int ii=0; ii<10; ++ii) {
		key[ii] = ii;
		fix[ii] = 0;
	}
	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) {
			++ sidx;
			match = n;
		}
		else if (n<match) {
			key[sidx] = key[sidx]-1>=0 ? key[sidx] : 9;
			++ sidx;
		}
		key[sidx] = (key[sidx]+1) % 10;
		KEYOUT;

	} while(true);

	return 0;
}
0