結果
| 問題 | No.161 制限ジャンケン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-22 01:15:46 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 823 bytes |
| 記録 | |
| コンパイル時間 | 3,983 ms |
| コンパイル使用メモリ | 82,720 KB |
| 実行使用メモリ | 47,428 KB |
| 最終ジャッジ日時 | 2026-03-17 13:31:35 |
| 合計ジャッジ時間 | 7,479 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}
}