結果

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

ソースコード

diff #

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL A, B, C;
	in >> A >> B >> C;

	for (LL i = 1; i <= A + 10 * B; ++i)
	{
		for (LL a = 0; a <= A; ++a)
		{
			for (LL b = 0; b <= B; ++b)
			{
				LL charge = (a + 10 * b) - i;
				if (charge < 0) continue;
				if (charge / 10 + charge % 10 + (A - a) + (B - b) == C)
				{
					out << i << std::endl;
					return 0;
				}
			}
		}
	}
	out << "Impossible" << std::endl;
}
0