結果

問題 No.825 賢いお買い物
ユーザー YkMlqYkMlq
提出日時 2019-05-03 22:52:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,083 bytes
コンパイル時間 1,674 ms
コンパイル使用メモリ 150,288 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 06:33:28
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int a,b,c;

int main(){
    cin >> a >> b >> c;
    if(a+b <= c){
        cout << "Impossible" << endl;
        return 0;
    }
    vector<int> pr;
    rep1(i,20+20*10){
        rep(j,a+1){
            rep(k,b+1){
                int h = a + b - j - k;
                int pay = j + 10*k;
                if((pay - i < 10) && (pay - i) >= 0 && (h + pay - i == c)) pr.pb(i);
                else if(pay - i >= 10 && h + (pay-i)/10 + (pay-i)%10 == c) pr.pb(i);
            }
        }
    }
    sort(ALL(pr));
    cout << pr[0] << endl;
}
0