結果
| 問題 | 
                            No.825 賢いお買い物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             fusilbayonet
                         | 
                    
| 提出日時 | 2019-05-26 01:06:32 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 649 bytes | 
| コンパイル時間 | 233 ms | 
| コンパイル使用メモリ | 31,744 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-17 15:07:54 | 
| 合計ジャッジ時間 | 888 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include<cstdio>
int main()
{
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);
    
    for(int price=1; price <= A + 10*B; price++)
        for(int a=0; a <= A; a++)
            for(int b=0; b <= B; b++) {
                const int pay = a + b*10;
                if(pay < price) {continue;}
                const int back = pay - price;
                const int pa = back % 10;
                const int pb = back / 10;
                const int coin = (A - a + pa) + (B - b + pb);
                if(C == coin) {
                    printf("%d", price);
                    return 0;
                }
            }
    printf("Impossible");
}
            
            
            
        
            
fusilbayonet