結果
| 問題 | No.825 賢いお買い物 |
| コンテスト | |
| ユーザー |
gazelle
|
| 提出日時 | 2019-05-03 22:50:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,188 bytes |
| 記録 | |
| コンパイル時間 | 1,179 ms |
| コンパイル使用メモリ | 112,468 KB |
| 最終ジャッジ日時 | 2025-01-07 03:27:37 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 7 WA * 12 |
ソースコード
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<math.h>
#include<functional>
#include<bitset>
#include<cassert>
using namespace std;
using lint = long long;
using ld = long double;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(lint i=n;i<(int)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
lint ans = INF * INF;
FOR(i, 1, 10 * b + a + 1) {
REP(j, a + 1) REP(k, b + 1) {
int diff = 10 * k + j - (10 * b + a);
if(diff < 0) continue;
int rem = (a - j) + (b - k) + diff / 10 + diff % 10;
if(rem == c) ans = min(ans, i);
}
}
if(ans = INF * INF) cout << "Impossible" << endl;
else cout << ans << endl;
return 0;
}
/* --------------------------------------- */
gazelle