結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-10 16:31:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 464 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 72,164 KB |
| 最終ジャッジ日時 | 2025-01-09 15:40:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include <iostream>
#include <vector>
const std::vector<int> mon{500, 100, 50, 10, 5, 1};
void solve() {
std::vector<int> ms(6);
for (auto& m : ms) std::cin >> m;
int g;
std::cin >> g;
for (int i = 0; i < 6; ++i) {
g -= std::min(g / mon[i], ms[i]) * mon[i];
}
std::cout << (g == 0 ? "YES" : "NO") << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}