結果

問題 No.161 制限ジャンケン
ユーザー MeloNMeloN
提出日時 2015-03-05 23:33:51
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,043 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 24,340 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 13:49:17
合計ジャッジ時間 1,301 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 0 ms
4,376 KB
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 (G > 0) {
                G--;
                point++;
            } else if (C > 0) {
                C--;
            }
        } else if (S[i] == 'C') {
            if (G > 0) {
                G--;
                point += 3;
            } else if (C > 0) {
                C--;
                point++;
            } else if (P > 0) {
                P--;
            }
        } else if (S[i] == 'P') {
            if (C > 0) {
                C--;
                point += 3;
            } else if (P > 0) {
                P--;
                point++;
            } else if (G > 0) {
                G--;
            }
        }
    }

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

    return (0);
}
0