結果

問題 No.825 賢いお買い物
ユーザー d_sei
提出日時 2019-09-05 19:43:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 81,884 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 22:46:25
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lont;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	while (A + B >= C+9) {
		if (A >= 10) {
			A -= 10;
			B++;
		}
		else {
			break;
		}
	}
	int ans = 0;
	while (A > 0 && A + B > C) {
		A--;
		ans += 1;
	}
		while (B > 0&&A+B>C) {
			B--;
			ans+=10;
		}
		if (ans) {
			cout << ans << endl;
		}
		else {
			cout << "Impossible" << endl;
		}
	}


	
0