結果
問題 | No.305 鍵(2) |
ユーザー |
![]() |
提出日時 | 2015-12-06 13:08:18 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 1,348 bytes |
コンパイル時間 | 999 ms |
コンパイル使用メモリ | 109,188 KB |
実行使用メモリ | 41,220 KB |
平均クエリ数 | 44.46 |
最終ジャッジ日時 | 2024-07-16 22:00:39 |
合計ジャッジ時間 | 2,250 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 [9 - digit] = (int)maxValue; } Console.WriteLine (string.Join (string.Empty, results)); if (Console.ReadLine () != "10 unlocked") { throw new Exception(); } } } }