結果
問題 |
No.11 カードマッチ
|
ユーザー |
![]() |
提出日時 | 2016-03-30 17:40:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 2,104 bytes |
コンパイル時間 | 2,344 ms |
コンパイル使用メモリ | 106,368 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-10-11 20:03:09 |
合計ジャッジ時間 | 2,154 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
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; public class Program { public void Proc() { Reader.IsDebug = false; int marcCount = int.Parse(Reader.ReadLine()); int numMax = int.Parse(Reader.ReadLine()); int tefuda = int.Parse(Reader.ReadLine()); Dictionary<int, int> markDic = new Dictionary<int, int>(); Dictionary<int, int> numDic = new Dictionary<int, int>(); for(int i=0; i<tefuda; i++) { int[] inpt = Reader.GetInt(); if(!markDic.ContainsKey(inpt[0])) { markDic.Add(inpt[0], 1); } else { markDic[inpt[0]]++; } if(!numDic.ContainsKey(inpt[1])) { numDic.Add(inpt[1], 1); } else { numDic[inpt[1]]++; } } long ans = 0; ans += (numDic.Count * marcCount); ans += (markDic.Count * numMax); ans -= (numDic.Count * markDic.Count); ans -= tefuda; Console.WriteLine(ans.ToString("####################################0")); } public class Reader { private static String InitText = @" 3 2 2 1 1 2 1 "; private static System.IO.StringReader sr = null; public static bool IsDebug = true; public static string ReadLine() { if(IsDebug) { if(sr == null) { sr = new System.IO.StringReader(InitText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ') { string[] inpt = ReadLine().Split(delimiter); int[] ret = new int[inpt.Length]; for(int i=0; i<inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }