結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2019-06-20 15:48:24 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 5,000 ms |
コード長 | 1,804 bytes |
コンパイル時間 | 1,043 ms |
コンパイル使用メモリ | 107,868 KB |
実行使用メモリ | 26,224 KB |
最終ジャッジ日時 | 2024-12-17 18:09:31 |
合計ジャッジ時間 | 1,627 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
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.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoderTest { class Program { static void Main(string[] args) { string num = "0123456789"; string n = Console.ReadLine(); int loop = int.Parse(n); int[] cnt = new int[10]; for (int i = 0; i < cnt.Length; i++) { cnt[i] = 0; } for(int i=0;i<loop;i++) { string str = Console.ReadLine(); string[] jiro = str.Split(' '); if(jiro[4]=="YES") { int a = int.Parse(jiro[0]); int b = int.Parse(jiro[1]); int c = int.Parse(jiro[2]); int d = int.Parse(jiro[3]); cnt[a] = cnt[a] + 1; cnt[b] = cnt[b] + 1; cnt[c] = cnt[c] + 1; cnt[d] = cnt[d] + 1; } else { int a = int.Parse(jiro[0]); int b = int.Parse(jiro[1]); int c = int.Parse(jiro[2]); int d = int.Parse(jiro[3]); cnt[a] = cnt[a] - 1; cnt[b] = cnt[b] - 1; cnt[c] = cnt[c] - 1; cnt[d] = cnt[d] - 1; } } string max = ""; int m = -10; for (int i=0;i<cnt.Length;i++) { if (m < cnt[i]) { max = num.Substring(i, 1); m = cnt[i]; } } Console.WriteLine(max); } } }