結果

問題 No.586 ダブルブッキング
ユーザー バカらっくバカらっく
提出日時 2017-11-03 22:24:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,491 bytes
コンパイル時間 2,578 ms
コンパイル使用メモリ 104,512 KB
実行使用メモリ 23,780 KB
最終ジャッジ日時 2023-08-14 16:53:11
合計ジャッジ時間 3,809 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,640 KB
testcase_01 AC 62 ms
23,648 KB
testcase_02 AC 62 ms
21,564 KB
testcase_03 AC 62 ms
21,524 KB
testcase_04 AC 64 ms
23,568 KB
testcase_05 AC 62 ms
23,780 KB
testcase_06 AC 61 ms
21,644 KB
testcase_07 AC 62 ms
23,696 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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();
    }
}
0