結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  leaf_1415 | 
| 提出日時 | 2019-05-05 00:29:30 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 428 bytes | 
| コンパイル時間 | 628 ms | 
| コンパイル使用メモリ | 55,100 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-23 13:20:05 | 
| 合計ジャッジ時間 | 1,286 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <iostream>
using namespace std;
int a, b, c;
int calc(int x)
{
	return x/10 + x%10;
}
int main(void)
{
	cin >> a >> b >> c;
	
	int ans = 1e9;
	for(int x = 1; x <= a+b*10; x++){
		for(int i = 0; i <= a; i++){
			for(int j = 0; j <= b; j++){
				if(i+j*10 < x) continue;
				if( (a+b) - (i+j) + calc(i+j*10-x) == c){
					cout << x << endl;
					return 0;
				}
			}
		}
	}
	cout << "Impossible" << endl;
	return 0;
}
            
            
            
        