結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
しらゆき
|
| 提出日時 | 2015-11-24 09:41:36 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 5,000 ms |
| コード長 | 907 bytes |
| コンパイル時間 | 817 ms |
| コンパイル使用メモリ | 110,704 KB |
| 実行使用メモリ | 18,176 KB |
| 最終ジャッジ日時 | 2024-11-30 04:47:16 |
| 合計ジャッジ時間 | 1,875 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Program
{
static void Main()
{
var tmp = Console.ReadLine().Split();
int g = int.Parse(tmp[0]);
int c = int.Parse(tmp[1]);
int p = int.Parse(tmp[2]);
var s = Console.ReadLine();
int g2, c2, p2;
g2 = c2 = p2 = 0;
for(int i = 0; i < s.Length; i++)
{
if (s[i] == 'G') g2++;
else if (s[i] == 'C') c2++;
else p2++;
}
int ans = 0;
int gwin = Math.Min(g, c2);
int cwin = Math.Min(c, p2);
int pwin = Math.Min(p, g2);
g -= gwin; c2 -= gwin;
c -= cwin; p2 -= cwin;
p -= pwin; g2 -= pwin;
ans += (gwin + cwin + pwin) * 3;
int gtie = Math.Min(g, g2);
int ctie = Math.Min(c, c2);
int ptie = Math.Min(p, p2);
ans += gtie + ctie + ptie;
Console.WriteLine(ans);
}
}
しらゆき