結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-04-10 17:50:59 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 668 bytes | 
| コンパイル時間 | 793 ms | 
| コンパイル使用メモリ | 66,432 KB | 
| 最終ジャッジ日時 | 2025-01-09 15:42:52 | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <iostream>
constexpr int X = 300;
void solve() {
    int a, b, c;
    std::cin >> a >> b >> c;
    for (int d = 1; d <= X; ++d) {
        for (int i = 0; i <= a; ++i) {
            for (int j = 0; j <= b; ++j) {
                int m = i + j * 10;
                if (m < d) continue;
                m -= d;
                if ((a - i) + (b - j) + m / 10 + m % 10 == c) {
                    std::cout << d << std::endl;
                    return;
                }
            }
        }
    }
    std::cout << "Impossible" << std::endl;
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        