結果

問題 No.176 2種類の切手
ユーザー ry0u_yd
提出日時 2015-04-02 23:39:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 463 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 71,204 KB
実行使用メモリ 343,488 KB
最終ジャッジ日時 2024-10-08 01:35:06
合計ジャッジ時間 5,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30

using namespace std;

int a,b,t,ans = INF;
map<int,bool> memo;

void dfs(int x)
{
	if(memo[x]) return;
	if(x >= t)
	{
		ans = min(ans,x);
		return;
	}

	memo[x] = true;
	dfs(x+a);
	dfs(x+b);
}

int main()
{
	cin >> a >> b >> t;

	dfs(0);
	cout << ans << endl;
	return 0;
}
0