結果
問題 | No.586 ダブルブッキング |
ユーザー |
![]() |
提出日時 | 2017-11-03 22:24:23 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 1,491 bytes |
コンパイル時間 | 1,063 ms |
コンパイル使用メモリ | 115,704 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-11-22 15:52:19 |
合計ジャッジ時間 | 1,595 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { long cost1 = int.Parse(Reader.ReadLine()); long cost2 = int.Parse(Reader.ReadLine()); int inputCount = int.Parse(Reader.ReadLine()); Dictionary<int, int> yoyaku = new Dictionary<int, int>(); for (int i = 0; i < inputCount; i++) { int num = int.Parse(Reader.ReadLine()); if(yoyaku.ContainsKey(num)) { yoyaku[num]++; } else { yoyaku[num] = 1; } } long ans = (cost1 + cost2) * yoyaku.Select(a => a.Value - 1).Sum(); Console.WriteLine(ans); } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 30000 50000 5 402 402 605 605 605 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }