結果

問題 No.176 2種類の切手
ユーザー btkbtk
提出日時 2015-04-03 00:26:12
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,700 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 92,252 KB
実行使用メモリ 349,568 KB
最終ジャッジ日時 2024-04-16 21:56:43
合計ジャッジ時間 5,206 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define reE(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
#define rE(i,b) reE(i,0,b)
#define reT(i,a,b) for(auto (i)=(a);(i)<(b);(i)++)
#define rT(i,b) reT(i,0,b)
#define rep(i,a,b) reE(i,a,b);
#define rev(i,a,b) for(auto (i)=(b)-1;(i)>=(a);(i)--)
#define fe(i,b) for (auto &(x):b);
#define itr(i,b) for(auto (i)=(b).begin();(i)!=(b).end();++(i))
#define rti(i,b) for(auto (i)=(b).rbegin();(i)!=(b).rend();++(i))
#define LL long long
#define all(b) (b).begin(),(b).end()

#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line  getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num

#define dir(xx,yy,x,y,i) (xx)=(x)+dir[(i)],(yy)=(y)+dir[(i)+1]

typedef complex<double> P;
typedef vector<P> Poly;

const LL INF = 1 << 30;
const double eps = 1e-8;
const int dir[] = { 0, 1, 0, -1, 0 };

int main(void){
	set<LL> dp;
	set<LL> num;
	LL A, B, T;
	cin >> A >> B >> T;
	num.insert(A);
	num.insert(B);
	A <<= 1;
	B <<= 1;
	while (A <= T){
		num.insert(A);
		A <<= 1;
	}
	while (B <= T){
		num.insert(B);
		B <<= 1;
	}
	dp.insert(0);
	for (auto x : num){
		list<LL> l;
		for (auto y : dp){
			if (y > T)break;
			l.push_back(x + y);
		}
		for (auto z : l)dp.insert(z);
	}
	cout << *dp.lower_bound(T) << endl;

	return(0);
}
0