結果

問題 No.842 初詣
ユーザー d_sei
提出日時 2019-09-05 12:50:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 81,552 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 06:47:02
合計ジャッジ時間 1,617 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lont;
int main() {
	int A, B, C, D, E, F, G;
	cin >> A >> B >> C >> D >> E >> F >> G;
	while (G >= 500 && A >= 1) {
		G -= 500;
		A--;
	}
	while (G >= 100 && B >= 1) {
		G -= 100;
		B--;
	}
	while (G >= 50 && C >= 1) {
		G -= 50;
		C--;
	}
	while (G >= 10 && D >= 1) {
		G -= 10;
		D--;
	}
	while (G >= 5 && E >= 1) {
		G -= 5;
		E--;
	}
	while (G >= 1 && F >= 1) {
		G -= 1;
		F--;
	}
	if (G==0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

	
0