結果

問題 No.825 賢いお買い物
ユーザー developmaso
提出日時 2019-05-03 23:26:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,617 bytes
コンパイル時間 1,807 ms
コンパイル使用メモリ 168,428 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-31 19:15:26
合計ジャッジ時間 2,521 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 7 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std; void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b){ if (a<b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if (b<a){ a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }

void _main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (A + B <= C) {
    cout << "Impossible" << endl;
    return;
  }

  int ans = 0;
  if (A + B - C >= 11 && A >= 11) {
    int t = (A - 1) / 10;
    A -= t * 10;
    B += t;
  }
  cout << A << ", " << B << endl;
  if (B <= C) {
    ans = (A + B) - C;
  } else {
    if (A >= C) ans = C;
    else        ans = A + 10 * (B - C);
  }
  cout << ans << endl;
}
0