結果
問題 | No.24 数当てゲーム |
ユーザー | bluemegane |
提出日時 | 2018-10-24 13:52:19 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 59 ms / 5,000 ms |
コード長 | 1,054 bytes |
コンパイル時間 | 2,738 ms |
コンパイル使用メモリ | 100,940 KB |
実行使用メモリ | 22,736 KB |
最終ジャッジ日時 | 2023-08-12 06:48:01 |
合計ジャッジ時間 | 4,045 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
18,604 KB |
testcase_01 | AC | 58 ms
20,660 KB |
testcase_02 | AC | 57 ms
22,700 KB |
testcase_03 | AC | 58 ms
20,648 KB |
testcase_04 | AC | 57 ms
20,656 KB |
testcase_05 | AC | 57 ms
20,772 KB |
testcase_06 | AC | 57 ms
20,812 KB |
testcase_07 | AC | 57 ms
18,748 KB |
testcase_08 | AC | 59 ms
22,736 KB |
testcase_09 | AC | 57 ms
20,868 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var a = new int[n, 5]; for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); for (int j = 0; j < 4; j++) a[i, j] = int.Parse(line[j]); a[i, 4] = line[4] == "YES" ? 1 : 0; } for (int i = 0; i <= 9; i++) if (check(a, n, i)) { Console.WriteLine(i); break; } } public static bool check(int[,] a, int n, int b) { for (int i = 0; i < n; i++) if (a[i, 4] == 0) { for (int j = 0; j < 4; j++) if (a[i, j] == b) return false; } else { var find = false; for (int k = 0; k < 4; k++) if (a[i, k] == b) find = true; if (!find) return false; } return true; } }