結果
問題 |
No.842 初詣
|
ユーザー |
![]() |
提出日時 | 2019-06-28 21:44:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 1,714 ms |
コンパイル使用メモリ | 191,880 KB |
最終ジャッジ日時 | 2025-01-07 05:28:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 10 |
ソースコード
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define int long long using namespace std; typedef pair<int, int> P; const int mod = 1000000007; const int INF = 1e18; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int d[6] = {500, 100, 50, 10, 5, 1}; int a[6]; rep(i, 0, 6) cin >> a[i]; int n; cin >> n; for(int i = 5; i >= 0; i--){ if(n >= d[i]){ int tmp = n / d[i]; tmp = min(tmp, a[i]); n -= d[i] * tmp; } } if(n == 0) cout << "YES" << endl; else cout << "NO" << endl; }