結果

問題 No.842 初詣
ユーザー TakaTaka
提出日時 2019-07-26 11:32:21
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,200 bytes
コンパイル時間 3,404 ms
コンパイル使用メモリ 78,100 KB
実行使用メモリ 111,836 KB
最終ジャッジ日時 2023-09-15 00:14:35
合計ジャッジ時間 10,385 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,734 ms
111,836 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
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 #

package temp;

import java.util.Scanner;

public class Temp1{
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

        // int 1つ分を読み込む
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int f = sc.nextInt();
        int g = sc.nextInt();

        for(int i=a; i>0; i++) {
        	if(g >= 500) {
        		g = g-500;
        	}
        }
        for(int i=b; i>0; i++) {
        	if(g >= 100) {
        		g = g-100;
        	}
        }
        for(int i=c; i>0; i++) {
        	if(g >= 50) {
        		g = g-50;
        	}
        }
        for(int i=d; i>0; i++) {
        	if(g >= 10) {
        		g = g-10;
        	}
        }
        for(int i=e; i>0; i++) {
        	if(g >= 5) {
        		g = g-5;
        	}
        }
        for(int i=f; i>0; i++) {
        	if(g >= 1) {
        		g = g-1;
        	}
        }
        if(g == 0) {
        	System.out.println("YES");
        }else {
        	System.out.println("NO");
        }

    }
}
0