結果

問題 No.176 2種類の切手
ユーザー fiord
提出日時 2015-08-30 23:29:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 158,400 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-08 03:31:29
合計ジャッジ時間 2,574 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 22 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int a,b,t;	cin>>a>>b>>t;
	long long int ans=(1LL<<60);
	for(int i=0;i<=a&&i*b<=t+b;i++){
		//b円をi枚使用->t-b*i/a枚a円を使うと近づく
		int aa=(t-b*i+a-1)/a;
		if(i*b+aa*a>t)	ans=min(ans,(long long int)i*b+aa*a);
	}
	cout<<ans<<endl;
}
0