結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int a, b, c; cin >> a >> b >> c;
  for (int x = 1; x <= a + 10 * b; ++x) {
    for (int i = 0; i <= a; ++i) for (int j = 0; j <= b; ++j) {
      if (i + 10 * j < x) continue;
      int r = i + 10 * j - x;
      int p = r / 10, q = r % 10;
      if (a - i + b - j + p + q == c) return cout << x << '\n', 0;
    }
  }
  cout << "Impossible" << '\n';
}
0