結果

問題 No.305 鍵(2)
ユーザー kimagureman
提出日時 2016-02-08 01:52:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 687 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 61,748 KB
実行使用メモリ 24,964 KB
平均クエリ数 6.54
最終ジャッジ日時 2024-07-16 22:53:48
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

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