結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-19 23:30:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 4,107 ms |
| コンパイル使用メモリ | 251,464 KB |
| 最終ジャッジ日時 | 2025-01-31 01:42:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
ll a,b,c;
ll f(ll n){
ll nb = b*n;
ll d = b - a;
nb -= min(n,(nb-c)/d)*d;
return nb;
}
void solve(){
if(a>b)swap(a,b);
ll n = (c+b-1)/b;
ll l = n,r = n*100;
while(r-l>1){
ll m = (l+r)/2;
if(f(m)<f(m+1)){
r = m;
}else{
l = m;
}
}
cout<<min(f(l),f(r))<<endl;
}
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> a >> b >> c;
solve();
}