結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-05-16 01:44:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,556 bytes |
| コンパイル時間 | 964 ms |
| コンパイル使用メモリ | 110,208 KB |
| 実行使用メモリ | 36,568 KB |
| 平均クエリ数 | 30.00 |
| 最終ジャッジ日時 | 2024-07-16 10:09:19 |
| 合計ジャッジ時間 | 3,339 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
class Program
{
public void Proc()
{
Dictionary<int, int> dic = new Dictionary<int, int>();
for(int i=0; i<=9; i++) {
Console.WriteLine(string.Empty.PadLeft(10, i.ToString()[0]));
string[] ret = Console.ReadLine().Split(' ');
int num = int.Parse(ret[0]);
if(num == 10) {
return;
}
dic.Add(i, num);
}
if(dic.Count(a=>a.Value == 0) > 0) {
Nullable<int>[] map = new Nullable<int>[10];
int umeNum = dic.Where(a=>a.Value == 0).First().Key;
for(int i=0; i<9; i++) {
if(dic[i] == 0) {
continue;
}
for(int j=0; j<dic[i]; j++) {
for(int k=0; k<10; k++) {
if(map[k] != null) {
continue;
}
int[] lst = new int[10];
lst = lst.Select(a=>umeNum).ToArray();
lst[k] = i;
Console.WriteLine(string.Join(string.Empty, lst));
string[] ret = Console.ReadLine().Split(' ');
int cnt = int.Parse(ret[0]);
if(cnt == 10) {
return;
}
if(cnt == 1) {
map[k] = i;
break;
}
}
}
}
Console.WriteLine(string.Join(string.Empty, map));
string ans = Console.ReadLine();
} else
{
Nullable<int>[] map = new Nullable<int>[10];
for(int i=0; i<= 8; i++) {
for(int j=0; j<10; j++) {
if(map[j] != null) {
continue;
}
int[] tmp = new int[10];
tmp = tmp.ToList().Select(a=> 9).ToArray();
tmp[j] = i;
Console.WriteLine(string.Join(string.Empty, tmp));
string[] ret = Console.ReadLine().Split(' ');
int cnt = int.Parse(ret[0]);
if(cnt == 10) {
return;
}
if(cnt == 2) {
map[j] = i;
break;
}
}
}
for(int i=0; i<map.Length; i++) {
if(map[i] == null) {
map[i] = 9;
}
}
Console.WriteLine(string.Join(string.Empty, map));
string ans = Console.ReadLine();
return;
}
}
public class Reader
{
public static bool IsDebug = true;
private static String PlainInput = @"
";
private static System.IO.StringReader Sr = null;
public static string ReadLine()
{
if (IsDebug)
{
if (Sr == null)
{
Sr = new System.IO.StringReader(PlainInput.Trim());
}
return Sr.ReadLine();
}
else
{
return Console.ReadLine();
}
}
}
static void Main()
{
Program prg = new Program();
prg.Proc();
}
}
14番