結果
問題 | No.662 スロットマシーン |
ユーザー |
![]() |
提出日時 | 2018-03-09 22:53:07 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 3,386 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 117,224 KB |
実行使用メモリ | 26,684 KB |
最終ジャッジ日時 | 2024-10-10 11:00:03 |
合計ジャッジ時間 | 2,389 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
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(){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 5star 10heart 20spade 50diamond 1006BelldiamondstarspadestarBell6BellheartstarBellheartdiamond6spadeheartspadestarBelldiamond";}public static void Main(string[] args){#if DEBUGReader.IsDebug = true;#endifProgram prg = new Program();prg.Proc();}}