結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-15 20:37:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,033 bytes |
| コンパイル時間 | 1,263 ms |
| コンパイル使用メモリ | 114,724 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 10:11:19 |
| 合計ジャッジ時間 | 2,210 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
for(int val=1; val<=10*b+a; ++val){
for(int x=0; x<=a; ++x){
for(int y=0; y<=b; ++y){
int rest = 10 * y + x - val;
if(rest < 0)
continue;
int z = a + b - x - y + rest / 10 + rest % 10;
if(z == c){
cout << val << endl;
return 0;
}
}
}
}
cout << "Impossible" << endl;
return 0;
}