結果
問題 | No.662 スロットマシーン |
ユーザー | iwkjosec |
提出日時 | 2018-03-10 00:45:40 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,388 ms / 2,000 ms |
コード長 | 3,397 bytes |
コンパイル時間 | 1,186 ms |
コンパイル使用メモリ | 108,672 KB |
実行使用メモリ | 20,224 KB |
最終ジャッジ日時 | 2024-10-11 00:05:27 |
合計ジャッジ時間 | 25,505 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,058 ms
19,840 KB |
testcase_01 | AC | 1,230 ms
19,584 KB |
testcase_02 | AC | 1,072 ms
19,584 KB |
testcase_03 | AC | 1,167 ms
19,456 KB |
testcase_04 | AC | 1,059 ms
19,712 KB |
testcase_05 | AC | 1,199 ms
19,840 KB |
testcase_06 | AC | 1,202 ms
19,840 KB |
testcase_07 | AC | 1,110 ms
19,840 KB |
testcase_08 | AC | 1,182 ms
20,096 KB |
testcase_09 | AC | 1,269 ms
19,840 KB |
testcase_10 | AC | 1,200 ms
20,224 KB |
testcase_11 | AC | 1,239 ms
20,096 KB |
testcase_12 | AC | 1,274 ms
19,968 KB |
testcase_13 | AC | 1,172 ms
19,968 KB |
testcase_14 | AC | 1,388 ms
20,224 KB |
testcase_15 | AC | 1,171 ms
20,224 KB |
testcase_16 | AC | 1,053 ms
19,712 KB |
testcase_17 | AC | 1,175 ms
20,096 KB |
testcase_18 | AC | 1,127 ms
20,224 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var s = new string[5]; var v = new int[5]; for (int i = 0; i < 5; i++) { var inp = ReadLine().Split(); s[i] = inp[0]; v[i] = int.Parse(inp[1]); } var reel = new string[3][]; var n = new int[3]; n[0] = int.Parse(ReadLine()); reel[0] = new string[n[0]]; for (int i = 0; i < n[0]; i++) { reel[0][i] = ReadLine(); } n[1] = int.Parse(ReadLine()); reel[1] = new string[n[1]]; for (int i = 0; i < n[1]; i++) { reel[1][i] = ReadLine(); } n[2] = int.Parse(ReadLine()); reel[2] = new string[n[2]]; for (int i = 0; i < n[2]; i++) { reel[2][i] = ReadLine(); } var g = new int[3][] { new int[5], new int[5], new int[5] }; for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { g[i][j] = reel[i].Count(x => x == s[j]); } } var u = new long[5]; for (int i = 0; i < 5; i++) { u[i] = (long)g[0][i] * g[1][i] * g[2][i] * 5; } var r = new Random(); var rsa = 0L; for (int i = 0; i < 5000000; i++) { var rs = 0; var r0 = r.Next(n[0] ); var r1 = r.Next(n[1] ); var r2 = r.Next(n[2] ); if (reel[0][r0] == reel[1][r1] && reel[0][r0] == reel[2][r2]) { rs += reel[0][r0] == s[0] ? v[0] : reel[0][r0] == s[1] ? v[1] : reel[0][r0] == s[2] ? v[2] : reel[0][r0] == s[3] ? v[3] : reel[0][r0] == s[4] ? v[4] : 0; } if (reel[0][(r0 + 1)%n[0]] == reel[1][(r1 + 1)%n[1]] && reel[0][(r0 + 1)%n[0]] == reel[2][(r2 + 1)%n[2]]) { rs += reel[0][(r0 + 1)%n[0]] == s[0] ? v[0] : reel[0][(r0 + 1)%n[0]] == s[1] ? v[1] : reel[0][(r0 + 1)%n[0]] == s[2] ? v[2] : reel[0][(r0 + 1)%n[0]] == s[3] ? v[3] : reel[0][(r0 + 1)%n[0]] == s[4] ? v[4] : 0; } if (reel[0][(r0 + 2)%n[0]] == reel[1][(r1 + 2)%n[1]] && reel[0][(r0 + 2)%n[0]] == reel[2][(r2 + 2)%n[2]]) { rs += reel[0][(r0 + 2)%n[0]] == s[0] ? v[0] : reel[0][(r0 + 2)%n[0]] == s[1] ? v[1] : reel[0][(r0 + 2)%n[0]] == s[2] ? v[2] : reel[0][(r0 + 2)%n[0]] == s[3] ? v[3] : reel[0][(r0 + 2)%n[0]] == s[4] ? v[4] : 0; } if (reel[0][r0] == reel[1][(r1 + 1)%n[1]] && reel[0][r0] == reel[2][(r2 + 2)%n[2]]) { rs += reel[0][r0] == s[0] ? v[0] : reel[0][r0] == s[1] ? v[1] : reel[0][r0] == s[2] ? v[2] : reel[0][r0] == s[3] ? v[3] : reel[0][r0] == s[4] ? v[4] : 0; } if (reel[0][(r0 + 2)%n[0]] == reel[1][(r1 + 1)%n[1]] && reel[0][(r0 + 2)%n[0]] == reel[2][r2]) { rs += reel[0][(r0 + 2)%n[0]] == s[0] ? v[0] : reel[0][(r0 + 2)%n[0]] == s[1] ? v[1] : reel[0][(r0 + 2)%n[0]] == s[2] ? v[2] : reel[0][(r0 + 2)%n[0]] == s[3] ? v[3] : reel[0][(r0 + 2)%n[0]] == s[4] ? v[4] : 0; } rsa += rs ; } WriteLine($@"{rsa/5000000.0} {u[0]} {u[1]} {u[2]} {u[3]} {u[4]}"); } }