結果

問題 No.842 初詣
コンテスト
ユーザー kyo1
提出日時 2020-08-10 09:53:57
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 340µs
コード長 668 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 988 ms
コンパイル使用メモリ 213,652 KB
実行使用メモリ 9,788 KB
最終ジャッジ日時 2026-10-12 06:16:55
合計ジャッジ時間 2,186 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, C, D, E, F, G;
  cin >> A >> B >> C >> D >> E >> F >> G;
  for (int a = 0; a < A + 1; a++) {
    for (int b = 0; b < B + 1; b++) {
      for (int c = 0; c < C + 1; c++) {
        for (int d = 0; d < D + 1; d++) {
          for (int e = 0; e < E + 1; e++) {
            for (int f = 0; f < F + 1; f++) {
              if (a * 500 + b * 100 + c * 50 + d * 10 + 5 * e + f == G) {
                cout << "YES" << '\n';
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << '\n';
  return 0;
}
0