結果

問題 No.842 初詣
ユーザー subsnsubsn
提出日時 2023-06-16 14:34:25
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 953 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 29,024 KB
実行使用メモリ 6,036 KB
最終ジャッジ日時 2023-09-06 13:22:58
合計ジャッジ時間 3,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
int main()
{
    int c_500, c_100, c_50, c_10, c_5, c_1,p;
    scanf("%d%d%d%d%d%d%d",&c_500,&c_100,&c_50,&c_10,&c_5,&c_1,&p);
    for (;;) {
        if (c_500 == 0 || !p) break;
        if (p > 499) {
            c_500--;
            p-=500;
        }
    }
    for (;;) {
        if (c_100 == 0 || !p) break;
        if (p > 99) {
            c_100--;
            p -= 100;
        }
    }
    for (;;) {
        if (c_50 == 0 || !p) break;
        if (p > 49) {
            c_50--;
            p -= 50;
        }
    }
    for (;;) {
        if (c_10 == 0 || !p) break;
        if (p > 9) {
            c_10--;
            p -= 10;
        }
    }
    for (;;) {
        if (c_5 == 0 || !p) break;
        if (p > 4) {
            c_5--;
            p -= 5;
        }
    }
    for (;;) {
        if (c_1 == 0 || !p) break;
        if (p > 0) {
            c_1--;
            p -= 1;
        }
    }
    p?puts("NO"):puts("YES");
}
0