結果

問題 No.586 ダブルブッキング
ユーザー ooh_20ooh_20
提出日時 2018-01-15 12:35:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 2,791 ms
コンパイル使用メモリ 102,324 KB
実行使用メモリ 22,668 KB
最終ジャッジ日時 2023-08-25 17:13:30
合計ジャッジ時間 3,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,652 KB
testcase_01 AC 59 ms
22,564 KB
testcase_02 AC 59 ms
22,640 KB
testcase_03 AC 60 ms
20,600 KB
testcase_04 AC 60 ms
22,668 KB
testcase_05 AC 58 ms
20,604 KB
testcase_06 AC 58 ms
22,656 KB
testcase_07 AC 58 ms
20,644 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.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