結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2019-06-28 22:04:57 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 2,196 ms |
| コンパイル使用メモリ | 73,228 KB |
| 実行使用メモリ | 37,084 KB |
| 最終ジャッジ日時 | 2024-07-02 04:45:48 |
| 合計ジャッジ時間 | 3,997 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sa = br.readLine().split(" ");
int[] a = new int[7];
for (int i = 0; i < 7; i++) {
a[i] = Integer.parseInt(sa[i]);
}
br.close();
int[] coin = {500, 100, 50, 10, 5, 1};
for (int i = 0; i < 6; i++) {
while (a[6] >= coin[i] && a[i] > 0) {
a[6] -= coin[i];
a[i]--;
}
}
if (a[6] == 0) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
ks2m