結果

問題 No.305 鍵(2)
ユーザー nanophoto12nanophoto12
提出日時 2015-12-06 13:02:17
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,349 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 105,572 KB
実行使用メモリ 38,948 KB
平均クエリ数 4.54
最終ジャッジ日時 2023-09-23 08:14:32
合計ジャッジ時間 5,707 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
38,544 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 78 ms
38,304 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No305
{
	class MainClass
	{
		private static long MulValue(int d)
		{
			long s = 1L;
			for(int i =0;i < d;i++)
			{
				s *= 10L;
			}
			return s;
		}

		public static void Main (string[] args)
		{
			long output = 0;
			Console.WriteLine (output.ToString ("D10"));
			var line = Console.ReadLine ();
			if (line == "10 unlocked") {
				return;
			}
			var firstMatched = Convert.ToInt32(line.Split (' ')[0]);
			int[] results = new int[10];
			for (int digit = 0; digit < 10; digit++) {
				long mul = MulValue (digit);
				long maxValue = 0;
				int maxCount = firstMatched;
				for (long i = 1; i < 10; i++) {
					long f = i * mul;
					Console.WriteLine (f.ToString ("D10"));
					var currentLine = Console.ReadLine ();
					if (currentLine == "10 unlocked") {
						return;
					}
					var currentMatched = Convert.ToInt32(currentLine.Split (' ')[0]);
					if (currentMatched > firstMatched) {
						maxValue = i;
						break;
					}
					if (currentMatched < firstMatched) {
						maxValue = 0;
						break;
					}
					if (currentMatched > maxCount) {
						maxValue = i;
						maxCount = currentMatched;
					}
				}
				results [10 - digit] = (int)maxValue;
			}
			Console.WriteLine (string.Join (string.Empty, results));
			if (Console.ReadLine () != "10 unlocked") {
				throw new Exception();
			}

		}
	}
}
0