結果

問題 No.842 初詣
ユーザー heyanxxheyanxx
提出日時 2019-07-04 09:11:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,374 bytes
コンパイル時間 3,959 ms
コンパイル使用メモリ 77,128 KB
実行使用メモリ 54,336 KB
最終ジャッジ日時 2023-10-19 07:32:33
合計ジャッジ時間 6,381 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
52,776 KB
testcase_01 AC 56 ms
52,780 KB
testcase_02 AC 56 ms
52,416 KB
testcase_03 AC 58 ms
52,804 KB
testcase_04 AC 57 ms
52,784 KB
testcase_05 AC 66 ms
54,336 KB
testcase_06 AC 57 ms
52,784 KB
testcase_07 AC 60 ms
52,404 KB
testcase_08 AC 56 ms
53,492 KB
testcase_09 AC 58 ms
53,440 KB
testcase_10 AC 67 ms
52,932 KB
testcase_11 AC 61 ms
53,484 KB
testcase_12 AC 56 ms
53,448 KB
testcase_13 AC 55 ms
52,804 KB
testcase_14 AC 55 ms
52,784 KB
testcase_15 AC 55 ms
52,784 KB
testcase_16 AC 58 ms
53,492 KB
testcase_17 AC 57 ms
53,444 KB
testcase_18 AC 57 ms
53,496 KB
testcase_19 AC 58 ms
53,492 KB
testcase_20 AC 56 ms
52,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.LinkedHashMap;

public class Yukicoder842 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		try {
			String str =bf.readLine();
			String[]str2=str.split(" ");
			int a=Integer.parseInt(str2[0]);
			int b=Integer.parseInt(str2[1]);
			int c=Integer.parseInt(str2[2]);
			int d=Integer.parseInt(str2[3]);
			int e=Integer.parseInt(str2[4]);
			int f=Integer.parseInt(str2[5]);
			int g=Integer.parseInt(str2[6]);
			
			if(a*500+b*100+c*50+d*10+e*5+f==g) {
				System.out.println("YES");
			}else if(a*500+b*100+c*50+d*10+e*5+f>g){
				for(int i=0;i<=a;i++) {
					for(int j=0;j<=b;j++) {
						for(int k=0;k<=c;k++) {
							for(int m=0;m<=d;m++) {
								for(int n=0;n<=e;n++) {
									for(int p=0;p<=f;p++) {
										if(i*500+j*100+k*50+m*10+n*5+p==g) {
											System.out.println("YES");
											return;
										}
									}
								}
							}
						}
						
					}
				}
				System.out.println("NO");
				
			}else {
				System.out.println("NO");
			}
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		

	}

}
0