結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-03-05 23:43:55 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 5,000 ms |
| コード長 | 886 bytes |
| コンパイル時間 | 3,413 ms |
| コンパイル使用メモリ | 78,180 KB |
| 実行使用メモリ | 54,232 KB |
| 最終ジャッジ日時 | 2024-11-30 04:25:51 |
| 合計ジャッジ時間 | 6,814 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
import java.util.ArrayList;
import java.util.Scanner;
public class yukicoder {
public static void dfs(int map[][],int p,int now,int lim,ArrayList<Integer> a){
}
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int g=sc.nextInt();
int c=sc.nextInt();
int p=sc.nextInt();
char a[]=sc.next().toCharArray();
int ge=0;
int ce=0;
int pe=0;
for(int i=0;i<a.length;i++){
if(a[i]=='G')ge++;
else if(a[i]=='C')ce++;
else pe++;
}
int ans=0;
int G=Math.min(g,ce);
ans+=G*3;
g-=G;
ce-=G;
int C=Math.min(c,pe);
ans+=C*3;
c-=C;
pe-=C;
int P=Math.min(p,ge);
ans+=P*3;
p-=P;
ge-=P;
ans+=Math.min(g,ge)+Math.min(c,ce)+Math.min(p,pe);
System.out.println(ans);
}
}