結果

問題 No.176 2種類の切手
ユーザー vain0
提出日時 2015-05-25 09:29:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 69,836 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 03:21:48
合計ジャッジ時間 1,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <map>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <iostream>
using namespace std;
#define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I))
#define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I))
#define all(_X) (_X).begin(), (_X).end()

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

	int c = a + b;
	int ccnt = t / c;
	int u = t - ccnt * c;

	int m = 2000000000;
	int acnt = ((u + a - 1) / a);
	int bcnt = ((u + b - 1) / b);
	m = min(m, (ccnt + 1) * c);
	m = min(m, acnt * a + ccnt * c);
	m = min(m, bcnt * b + ccnt * c);
	cout << m << endl;

	return 0;
}
0