結果
| 問題 | No.842 初詣 | 
| コンテスト | |
| ユーザー |  tenten | 
| 提出日時 | 2020-08-31 23:06:58 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 125 ms / 2,000 ms | 
| コード長 | 583 bytes | 
| コンパイル時間 | 5,554 ms | 
| コンパイル使用メモリ | 73,984 KB | 
| 実行使用メモリ | 41,268 KB | 
| 最終ジャッジ日時 | 2024-11-17 02:46:23 | 
| 合計ジャッジ時間 | 6,833 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 21 | 
ソースコード
import java.util.*;
public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int[] values = new int[]{500, 100, 50, 10, 5, 1};
    	int[] counts = new int[6];
    	for (int i = 0; i < 6; i++) {
    	    counts[i] = sc.nextInt();
    	}
    	int total = sc.nextInt();
    	for (int i = 0; i < 6; i++) {
    	    int result = total / values[i];
    	    total -= Math.min(counts[i], result) * values[i];
    	}
    	if (total == 0) {
    	    System.out.println("YES");
    	} else {
    	    System.out.println("NO");
    	}
	}
}
            
            
            
        