結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  a01sa01to | 
| 提出日時 | 2024-10-31 00:28:46 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 757 bytes | 
| コンパイル時間 | 2,917 ms | 
| コンパイル使用メモリ | 243,604 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-31 00:28:51 | 
| 合計ジャッジ時間 | 4,229 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline int returned(int a, int b, int c) {
  int rem = a + 10 * b - c;
  if (rem < 0) return -1e9;
  return rem / 10 + rem % 10;
}
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  rep(cost, 300) {
  	if (cost == 0) continue;
    rep(a_used, a + 1) rep(b_used, b + 1) {
      int num = 0;
      num += a - a_used;
      num += b - b_used;
      num += returned(a_used, b_used, cost);
      if (num == c) {
        cout << cost << endl;
        return 0;
      }
    }
  }
  cout << "Impossible" << endl;
  return 0;
}
            
            
            
        