結果

問題 No.161 制限ジャンケン
ユーザー MeloNMeloN
提出日時 2015-03-06 17:21:25
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,051 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 24,592 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 15:30:39
合計ジャッジ時間 1,705 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,384 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#define MAX 300

int main(void)
{
    int point = 0, G,C,P,count,i;
    char S[MAX];

    scanf("%d%d%d",&G,&C,&P);
    scanf("%s",S);

    count = G+C+P;

    for (i = 0; i < count; i++) {
        if (S[i] == 'G') {
            if (P > 0) {
                P--;
                point += 3;
            }
        } else if (S[i] == 'C') {
            if (G > 0) {
                G--;
                point += 3;
            }
        } else if (S[i] == 'P') {
            if (C > 0) {
                C--;
                point += 3;
            }
        }
    }

    for (i = 0; i < count; i++) {
        if (S[i] == 'G') {
            if (G > 0) {
                G--;
                point++;
            }
        } else if (S[i] == 'C') {
            if (C > 0) {
                C--;
                point++;
            }
        } else if (S[i] == 'P') {
            if (P > 0) {
                P--;
                point++;
            }
        }
    }

    printf("%d\n",point);

    return (0);
}
0