結果

問題 No.305 鍵(2)
ユーザー kimagureman
提出日時 2016-02-08 01:39:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 707 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 61,932 KB
実行使用メモリ 25,220 KB
平均クエリ数 370.38
最終ジャッジ日時 2024-07-16 08:34:24
合計ジャッジ時間 6,007 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 RE * 4 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

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