結果

問題 No.842 初詣
ユーザー TomoyaTomoya
提出日時 2019-06-28 21:48:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 1,220 bytes
コンパイル時間 5,211 ms
コンパイル使用メモリ 77,096 KB
実行使用メモリ 56,288 KB
最終ジャッジ日時 2023-09-14 21:50:33
合計ジャッジ時間 6,889 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,440 KB
testcase_01 AC 118 ms
55,724 KB
testcase_02 AC 117 ms
55,884 KB
testcase_03 AC 121 ms
55,892 KB
testcase_04 AC 121 ms
55,408 KB
testcase_05 AC 131 ms
55,980 KB
testcase_06 AC 118 ms
55,832 KB
testcase_07 AC 122 ms
56,020 KB
testcase_08 AC 118 ms
55,972 KB
testcase_09 AC 121 ms
56,288 KB
testcase_10 AC 146 ms
55,740 KB
testcase_11 AC 120 ms
55,700 KB
testcase_12 AC 126 ms
55,636 KB
testcase_13 AC 122 ms
55,804 KB
testcase_14 AC 119 ms
55,876 KB
testcase_15 AC 118 ms
55,664 KB
testcase_16 AC 119 ms
55,764 KB
testcase_17 AC 122 ms
55,688 KB
testcase_18 AC 129 ms
55,464 KB
testcase_19 AC 120 ms
55,664 KB
testcase_20 AC 134 ms
55,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main.java.yukicoder;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        //System.out.println();
        Scanner scanner = new Scanner(System.in);
        
        int[] Val = new int[7];
        for(int i=0; i<7; i++) Val[i] = Integer.parseInt(scanner.next());   
        /*
        int [] Val = new int[7];
        Val[0] = 0;
        Val[1] = 0;
        Val[2] = 2;
        Val[3] = 0;
        Val[4] = 1;
        Val[5] = 9;
        Val[6] = 114;
        */
        boolean f = false;
        for(int i=0; i<=Val[0]; i++) {
            for(int j=0; j<=Val[1]; j++) {
                for(int k=0; k<=Val[2]; k++) {
                    for(int l=0; l<=Val[3]; l++) {
                        for(int m=0; m<=Val[4]; m++) {
                            for(int n=0; n<=Val[5]; n++) {
                                if(500*i+100*j+50*k+10*l+5*m+n == Val[6]) f = true;
                                //System.out.println(i+j+k+l+m+n);
                            }
                        }
                    }
                }
            }
        }
        if(f) System.out.println("YES");
        else System.out.println("NO");

        scanner.close();
    }
}
0