結果
問題 | No.842 初詣 |
ユーザー |
![]() |
提出日時 | 2019-06-28 22:44:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,249 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 193,292 KB |
最終ジャッジ日時 | 2025-01-07 05:34:57 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include<bits/stdc++.h> #define FOR(i, n, m) for(int i = n; i < (int)m; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define pb push_back using namespace std; using ll = std::int_fast64_t; using ld = long double; using P = pair<ll, ll>; constexpr ll inf = 1000000000; constexpr ll mod = 1000000007; constexpr long double eps = 1e-15; template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> p) { os << to_string(p.first) << " " << to_string(p.second); return os; } template<typename T> ostream& operator<<(ostream& os, vector<T>& v) { REP(i, v.size()) { if(i) os << " "; os << to_string(v[i]); } return os; } /* template<typename T> struct Treap { double drand() { // random number in [0, 1] static random_device rd; static mt19937 mt(rd()); return (unsigned)mt() / (double)numeric_limits<unsigned>::max(); } T v; double p; int cnt; Treap* lch; Treap* rch; Treap(T v) : v(v), p(drand()), cnt(1), lch(NULL), rch(NULL) { } Treap* update() { this->size = size(this->lch) + size(this->rch) + 1; return this; } static int size(Treap* t) { if(!t) return 0; else return t->cnt; } static Treap* merge(Treap* l, Treap* r) { if(!l || !r) { if(!l) return r; else return l; } if(l->p >= r->p) { l->rch = merge(l->rch, r); return l->update(); } else { r->lch = merge(r->lch, l); return r->update(); } } static pair<Treap*, Treap*> split(Treap* t, int k) { // split [0, k) and [k, n) if(k == 0) return {NULL, t}; if(!(t->l)) { auto tmp = split(t->r, k - 1); t->r = tmp.first; return {t->update(), tmp.second}; } else if(!(t->r)) { auto tmp = split(t->r, k - 1); t->r = tmp.first; return {t->update(), tmp.second}; } else { } } Treap* insert() { } Treap* erase() { } T operator[](int k) { } }; */ int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; REP(i, a + 1) REP(j, b + 1) REP(k, c + 1) { REP(l, d + 1) REP(m, e + 1) REP(n, f + 1) { if(500 * i + 100 * j + 50 * k + 10 * l + 5 * m + 1 * n == g) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; } // ---------------------------------------