結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
lotus
|
| 提出日時 | 2019-06-28 22:06:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 459 bytes |
| コンパイル時間 | 1,467 ms |
| コンパイル使用メモリ | 166,412 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 04:46:04 |
| 合計ジャッジ時間 | 2,204 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long i64;
typedef pair<i64,i64> P;
int a[10];
int main(){
int c[7] = {500,100,50,10,5,1,-1};
for(int i = 0; i < 7; i++){
cin >> a[i];
}
for(int i = 0; i < 6; i++){
while(a[6] - c[i] >= 0 && a[i] > 0){
a[i]--;
a[6] -= c[i];
}
}
if(a[6] == 0){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
return 0;
}
lotus