結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
m1025o1184t
|
| 提出日時 | 2019-10-12 22:26:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 1,573 ms |
| コンパイル使用メモリ | 166,292 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-29 15:20:12 |
| 合計ジャッジ時間 | 2,495 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<(n);++i)
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
assert(0 <= a and a <= 20);
assert(0 <= b and b <= 20);
assert(0 <= c and c <= 100);
for (int price = 1; price <= a + b * 10; price++) {
for (int i = 0; i <= a; ++i) {
for (int j = 0; j <= b; ++j) {
const int pay = i + 10 * j;
if (pay < price)continue;
const int back = pay - price;
const int pa = back % 10;
const int pb = back / 10;
const int coin = (a - i + pa) + (b - j + pb);
if (coin == c) {
cout << price << endl;
return 0;
}
}
}
}
cout << "Impossible" << endl;
return 0;
}
m1025o1184t