結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2015-03-05 23:31:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 5,000 ms |
| コード長 | 1,284 bytes |
| コンパイル時間 | 997 ms |
| コンパイル使用メモリ | 107,008 KB |
| 実行使用メモリ | 18,176 KB |
| 最終ジャッジ日時 | 2024-11-30 04:24:45 |
| 合計ジャッジ時間 | 2,043 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
int g=0,c=0,p=0;
for(int i=0;i<S.Length;i++){
if(S[i]=='G')g++;
if(S[i]=='C')c++;
if(S[i]=='P')p++;
}
int cnt=0;
int Gw=Math.Min(G,c);
G-=Gw;c-=Gw;
int Cw=Math.Min(C,p);
C-=Cw;p-=Cw;
int Pw=Math.Min(P,g);
P-=Pw;g-=Pw;
cnt+=3*(Gw+Cw+Pw);
int Ge=Math.Min(G,g);
cnt+=Ge;
int Ce=Math.Min(C,c);
cnt+=Ce;
int Pe=Math.Min(P,p);
cnt+=Pe;
Console.WriteLine(cnt);
}
int G,C,P;
String S;
public Sol(){
var d=ria();
G=d[0];C=d[1];P=d[2];
S=rs();
}
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 Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
kuuso1