結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
ponchan
|
| 提出日時 | 2019-05-08 11:15:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 646 bytes |
| コンパイル時間 | 539 ms |
| コンパイル使用メモリ | 66,944 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 00:26:23 |
| 合計ジャッジ時間 | 1,272 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a ,b ,c;
cin >> a >> b >> c;
int ans = 1e9;
for (int i = 0; i <= a; i++){
for (int j = 0; j <= b; j++){
if (i + j == 0) continue;
int now = i + j*10;
int rest = a - i + b -j;
for (int k = 0; k < now; k++)
{
int back = rest + k / 10 + k % 10;
if (back == c) ans = min(ans,now - k);
}
}
}
if (ans < 1e9) cout << ans << endl;
else cout << "Impossible" << endl;
}
ponchan