結果
問題 | No.825 賢いお買い物 |
ユーザー |
|
提出日時 | 2019-05-03 21:23:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 66,224 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 17:06:21 |
合計ジャッジ時間 | 1,451 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include<iostream> using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; auto opt = [](int x)->int{ return x%10 + x/10; }; int ans = 1<<30; for(int i = 0; i <= a; i++){ for(int j = 0; j <= b; j++){ int tmp = i + 10*j; for(int k = 1; k <= tmp; k++){ int num = a+b-i-j+opt(tmp-k); if(num == c) ans = min(ans, k); } } } if(ans == 1<<30) cout << "Impossible" << endl; else cout << ans << endl; return 0; }