結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-08-28 07:26:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 66,304 KB |
| 最終ジャッジ日時 | 2025-01-13 15:55:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <iostream>
using namespace std;
const int INF = 100000;
int main(){
int A, B, C;
cin >> A >> B >> C;
int ans = INF;
for (int i = 0; i <= A; i++){
for (int j = 0; j <= B; j++){
int c = i + j * 10;
for (int k = 0; k < c; k++){
if ((A - i + k % 10) + (B - j + k / 10) == C){
ans = min(ans, c - k);
}
}
}
}
if (ans == INF){
cout << "Impossible" << endl;
} else {
cout << ans << endl;
}
}
SSRS