結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  icun | 
| 提出日時 | 2019-07-09 17:03:56 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 811 bytes | 
| コンパイル時間 | 442 ms | 
| コンパイル使用メモリ | 57,188 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-12 08:25:03 | 
| 合計ジャッジ時間 | 1,373 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <cstdlib>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int t = A + 10 * B + 1;
    rep(i, 1, t) {
        rep(a, A + 1) {
            rep(b, B + 1) {
                int p = a + 10 * b;
                int c = p - i;
                if(c < 0)
                    continue;
                if(C == (c / 10 + c % 10 + A - a + B - b)) {
                    cout << i << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Impossible" << endl;
    return 0;
}
            
            
            
        