結果
問題 | No.176 2種類の切手 |
ユーザー |
![]() |
提出日時 | 2018-06-17 23:57:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 182 ms / 1,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 1,203 ms |
コンパイル使用メモリ | 159,132 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 16:41:22 |
合計ジャッジ時間 | 2,927 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define all(vec) vec.begin(),vec.end()typedef long long int ll;typedef pair<ll,ll> P;const ll MOD=1000000007;const ll INF=1000000010;const ll LINF=4000000000000000010LL;const int MAX=310;const double EPS=1e-3;int dx[4]={0,1,0,1};int dy[4]={0,0,1,1};int main(){ll a,b,t;cin>>a>>b>>t;ll c=a*(t/a);if(t>c||c==0)c+=a;ll aa=c/a;ll ans=c;for(int i=0;i<=10000000;i++){c+=b;aa-=(c-t)/a;if(aa<0)break;c-=a*((c-t)/a);ans=min(c,ans);}cout<<ans<<endl;return 0;}