結果
問題 | No.176 2種類の切手 |
ユーザー |
![]() |
提出日時 | 2015-08-30 23:32:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 332 bytes |
コンパイル時間 | 1,297 ms |
コンパイル使用メモリ | 159,368 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 03:31:36 |
合計ジャッジ時間 | 2,307 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#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-1)*b<=t;i++){//b円をi枚使用->t-b*i/a枚a円を使うと近づくlong long 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;}