結果

問題 No.662 スロットマシーン
ユーザー バカらっくバカらっく
提出日時 2018-03-09 22:53:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 3,386 bytes
コンパイル時間 2,849 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-04-18 17:40:58
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
18,304 KB
testcase_01 AC 25 ms
18,560 KB
testcase_02 AC 25 ms
18,176 KB
testcase_03 AC 24 ms
18,432 KB
testcase_04 AC 26 ms
18,176 KB
testcase_05 AC 28 ms
18,304 KB
testcase_06 AC 27 ms
18,688 KB
testcase_07 AC 26 ms
18,432 KB
testcase_08 AC 29 ms
18,688 KB
testcase_09 AC 32 ms
18,688 KB
testcase_10 AC 33 ms
18,688 KB
testcase_11 AC 29 ms
18,560 KB
testcase_12 AC 29 ms
18,432 KB
testcase_13 AC 30 ms
18,816 KB
testcase_14 AC 31 ms
18,688 KB
testcase_15 AC 29 ms
18,560 KB
testcase_16 AC 26 ms
18,432 KB
testcase_17 AC 37 ms
18,688 KB
testcase_18 AC 34 ms
18,816 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()
    {
        string[] names = new string[5];
        decimal totalCase = 0;
        for (int i = 0; i < 5; i++) {
            string[] inpt = Reader.ReadLine().Split(' ');
            int s = int.Parse(inpt[1]);
            Score.Add(inpt[0], s);
            names[i] = inpt[0];
        }

        int realLen = int.Parse(Reader.ReadLine());
        totalCase = realLen;
        for (int i = 0; i < realLen; i++) {
            string inpt = Reader.ReadLine();
            if(Real1.ContainsKey(inpt)) {
                Real1[inpt]++;
            } else {
                Real1[inpt] = 1;
            }
        }
        realLen = int.Parse(Reader.ReadLine());
        totalCase *= realLen;
        for (int i = 0; i < realLen; i++)
        {
            string inpt = Reader.ReadLine();
            if (Real2.ContainsKey(inpt))
            {
                Real2[inpt]++;
            }
            else
            {
                Real2[inpt] = 1;
            }
        }
        realLen = int.Parse(Reader.ReadLine());
        totalCase *= realLen;
        for (int i = 0; i < realLen; i++)
        {
            string inpt = Reader.ReadLine();
            if (Real3.ContainsKey(inpt))
            {
                Real3[inpt]++;
            }
            else
            {
                Real3[inpt] = 1;
            }
        }


        decimal totalPoint = 0;
        StringBuilder ans = new StringBuilder();
        foreach (string n in names) {
            decimal point = 0;
            if(Real1.ContainsKey(n)) {
                point = Real1[n];
            }
            if(Real2.ContainsKey(n)) {
                point *= Real2[n];
            } else {
                point = 0;
            }
            if(Real3.ContainsKey(n)) {
                point *= Real3[n];
            } else {
                point = 0;
            }
            point *= 5;
            totalPoint += (point * Score[n]);
            ans.AppendLine(((long)point).ToString());
        }
        Console.WriteLine(totalPoint / totalCase);
        Console.Write(ans.ToString());
    }

    private Dictionary<string, int> Real1 = new Dictionary<string, int>();
    private Dictionary<string, int> Real2 = new Dictionary<string, int>();
    private Dictionary<string, int> Real3 = new Dictionary<string, int>();

    private Dictionary<string, int> Score = new Dictionary<string, int>();


    public class Reader
    {
        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 = @"



Bell 5
star 10
heart 20
spade 50
diamond 100
6
Bell
diamond
star
spade
star
Bell
6
Bell
heart
star
Bell
heart
diamond
6
spade
heart
spade
star
Bell
diamond


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0