結果

問題 No.176 2種類の切手
ユーザー saytakaPC
提出日時 2015-04-02 23:50:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 1,189 ms
コンパイル使用メモリ 157,704 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-08 01:42:55
合計ジャッジ時間 3,883 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 4 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
	ll a,b,t,ans=2000000001;
	cin>>a>>b>>t;
	for(int i=0;i<=(t/b)+1;i++){
		ll tmp=t-b*i;
		if(tmp%a==0){
			ans=t;
			break;
		}else{
			ans=min(ans,(tmp/a+1)*a+b*i);
		}
	}
	cout<<ans<<endl;
} 
0