結果

問題 No.176 2種類の切手
ユーザー srup٩(๑`н´๑)۶
提出日時 2016-10-04 22:25:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 61,360 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 16:55:13
合計ジャッジ時間 5,370 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 9 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

int main(void){
	int a, b, t; cin >> a >> b >> t;
	int ans = INF;
	for (int i = 0; i <= 1e9; ++i){//bの数
		if(b * i <= t){
			int nokori = t - b * i;
			int j;
			if(nokori % a == 0){
				j = nokori / a;
			}else{
				j = nokori / a + 1;
			}
			ans = min(ans, b * i + a * j);
		}else{
			break;
		}
	}
	printf("%d\n", ans);
	return 0;
}
0