結果
問題 |
No.11 カードマッチ
|
ユーザー |
![]() |
提出日時 | 2017-06-08 10:01:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,008 bytes |
コンパイル時間 | 1,596 ms |
コンパイル使用メモリ | 112,228 KB |
実行使用メモリ | 83,628 KB |
最終ジャッジ日時 | 2024-09-22 13:26:21 |
合計ジャッジ時間 | 3,874 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 14 |
コンパイルメッセージ
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; class Program { static void Main() { int W = int.Parse(Console.ReadLine()); // トランプのマークの種類 int H = int.Parse(Console.ReadLine()); // トランプの数値の最大 int N = int.Parse(Console.ReadLine()); // 手元の枚数 List<int>[] SK = new List<int>[W + 1]; for (int i = 0; i < W + 1; i++) { SK[i] = new List<int>(); } string[] tmp = new string[2]; for (int i = 0; i < N; i++) { tmp = Console.ReadLine().Split(' '); SK[int.Parse(tmp[0])].Add(int.Parse(tmp[1])); } decimal ansCnt = 0; int cnt = 0; int maxCnt = 0; for (int i = 1; i <= W; i++) { cnt = SK[i].Count(); if (maxCnt < cnt) { maxCnt = cnt; } if (0 < cnt) { ansCnt += H - cnt; } else { ansCnt += maxCnt; } } Console.WriteLine(ansCnt); } }