結果

問題 No.586 ダブルブッキング
ユーザー ooh_20
提出日時 2018-01-15 12:35:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 2,032 ms
コンパイル使用メモリ 104,448 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-12-24 02:34:52
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;
using System.Collections.Generic;

namespace lecture
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int P = int.Parse(Console.ReadLine());
            P += int.Parse(Console.ReadLine());

            int N = int.Parse(Console.ReadLine());

            Dictionary<string, int> roomNumber = new Dictionary<string,int>();

            for (int i = 0; i < N; i++)
            {
                string R = Console.ReadLine();
                if (roomNumber.ContainsKey(R))
                {
                    roomNumber[R]++;
                }
                else
                {
                    roomNumber[R] = 1;
                }
            }

            int count = 0;

            foreach (int cnt in roomNumber.Values)
            {
                if (cnt > 1)
                {
                    count += cnt - 1;
                }
            }

            Console.WriteLine(count * P);
        }
    }
}
0