結果

問題 No.825 賢いお買い物
ユーザー aaaaaaiu
提出日時 2019-08-01 16:18:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 552 bytes
コンパイル時間 1,885 ms
コンパイル使用メモリ 192,472 KB
最終ジャッジ日時 2025-01-07 10:27:40
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int a, b, c;
    cin>>a>>b>>c;
    for (int i = 1; i < 10000; i++)
        for (int j = 0; j <= a; j++)
            for (int k = 0; k <= b; k++) {
                int sum = j + 10*k;
                if (sum < i) continue;
                int change = sum - i;
                if (a-j + b-k + change/10 + change%10 == c) {
                    cout << i << endl;
                    return 0;
                }
            }
    cout << "Impossible\n";
    return 0;
}
0