結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-22 01:15:46 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 823 bytes |
| コンパイル時間 | 3,499 ms |
| コンパイル使用メモリ | 75,500 KB |
| 実行使用メモリ | 41,672 KB |
| 最終ジャッジ日時 | 2024-06-28 15:41:06 |
| 合計ジャッジ時間 | 6,866 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 9 |
ソースコード
import java.util.Scanner;
public class No161{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num_G = sc.nextInt();
int num_C = sc.nextInt();
int num_P = sc.nextInt();
String[] S = sc.next().split("");
int score = 0;
for(int i = 0; i < S.length; i++){
if(S[i].equals("G")){
if(num_P > 0){
num_P--;
score += 3;
}else if(num_G > 0){
num_G--;
score += 1;
}else{
num_C--;
}
}else if(S[i].equals("C")){
if(num_G > 0){
num_G--;
score += 3;
}else if(num_C > 0){
num_C--;
score += 1;
}else{
num_P--;
}
}else{
if(num_C > 0){
num_C--;
score += 3;
}else if(num_P > 0){
num_P--;
score += 1;
}else{
num_G--;
}
}
}
System.out.println(score);
}
}