結果
問題 | No.161 制限ジャンケン |
ユーザー | nuwasogi |
提出日時 | 2015-11-22 18:51:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 73 ms / 5,000 ms |
コード長 | 2,120 bytes |
コンパイル時間 | 5,975 ms |
コンパイル使用メモリ | 105,064 KB |
実行使用メモリ | 24,016 KB |
最終ジャッジ日時 | 2023-08-20 04:42:53 |
合計ジャッジ時間 | 4,857 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
23,892 KB |
testcase_01 | AC | 65 ms
21,892 KB |
testcase_02 | AC | 66 ms
22,016 KB |
testcase_03 | AC | 66 ms
22,024 KB |
testcase_04 | AC | 65 ms
21,768 KB |
testcase_05 | AC | 66 ms
23,932 KB |
testcase_06 | AC | 73 ms
23,968 KB |
testcase_07 | AC | 66 ms
21,940 KB |
testcase_08 | AC | 66 ms
23,908 KB |
testcase_09 | AC | 68 ms
21,884 KB |
testcase_10 | AC | 66 ms
21,896 KB |
testcase_11 | AC | 65 ms
22,020 KB |
testcase_12 | AC | 64 ms
21,824 KB |
testcase_13 | AC | 72 ms
24,016 KB |
testcase_14 | AC | 68 ms
23,912 KB |
testcase_15 | AC | 65 ms
21,952 KB |
testcase_16 | AC | 67 ms
21,880 KB |
testcase_17 | AC | 66 ms
21,868 KB |
testcase_18 | AC | 66 ms
23,896 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.Linq; namespace Seigen_Janken { class Program { static void Main(string[] args) { Sol sol = new Sol(); sol.Solve(); } } class Sol { public void Solve() { int GN = Math.Min(G, eC); int CN = Math.Min(C, eP); int PN = Math.Min(P, eG); G -= GN; eC -= GN; C -= CN; eP -= CN; P -= PN; eG -= PN; int GDraw = Math.Min(G, eG); int CDraw = Math.Min(C, eC); int PDraw = Math.Min(P, eP); int aiko = GDraw + CDraw + PDraw; int ans = 3 * (GN + CN + PN) + aiko; Console.WriteLine(ans); } int G, C, P; string S; int eG, eC, eP; public Sol() { int[] t = ria(); G = t[0]; C = t[1]; P = t[2]; S = rs(); eG = CountChar(S, 'G'); eC = CountChar(S, 'C'); eP = CountChar(S, 'P'); } // 文字列s中に含まれるcの数を返す static int CountChar(string s, char c) { return s.Length - s.Replace(c.ToString(), "").Length; } public override string ToString() { return (string.Format("G:{0}, C:{1}, P{2}\n", G, C, P) + S + string.Format("\neG:{0}, eC:{1}, eP{2}", eG, eC, eP)); } static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa() { return Console.ReadLine().Split(' '); } static int[] ria() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); } static long[] rla() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); } static double[] rda() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); } } }