結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-27 02:38:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 532 bytes |
| コンパイル時間 | 2,001 ms |
| コンパイル使用メモリ | 192,888 KB |
| 最終ジャッジ日時 | 2025-02-07 16:47:15 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int A[6]; rep(i,6) cin >> A[i];
int G; cin >> G;
int C[] = {500, 100, 50, 10, 5, 1};
rep(a,A[0]+1)rep(b,A[1]+1)rep(c,A[2]+1)rep(d,A[3]+1)rep(e,A[4]+1)rep(f,A[5]+1){
int sum = a * C[0] + b * C[1] + c * C[2] + d * C[3] + e * C[4] + f * C[5];
if(sum == G) { cout << "YES" << endl; return 0; }
}
cout << "NO" << endl;
}