結果

問題 No.928 軽減税率?
ユーザー 👑 CleyL
提出日時 2022-01-27 22:23:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 64,256 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 04:55:18
合計ジャッジ時間 1,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
  long long a,b,c;cin>>a>>b>>c;
  if(a==b){
    if(c){
      cout << 1000000000 << endl;
    }else{
      cout << 0 << endl;
    }
    return 0;
  }
  long long mx = 1000000001;
  long long mn = 1;
  while(mx-mn > 1){
    long long ce = (mx+mn)/2;
    if(ce*(100+a)/100 < ce*(100+b)/100+c){
      mn = ce;
    }else{
      mx = ce;
    }
  }
  long long mx2 = 1000000001;
  long long mn2 = 1;
  while(mx2-mn2 > 1){
    long long ce = (mx2+mn2)/2;
    if(ce*(100+a)/100 <= ce*(100+b)/100+c){
      mn2 = ce;
    }else{
      mx2 = ce;
    }
  }
  int ans = mn;
  for(int i = mn+1;mn2 >= i;i++){
    if(i*(100+a)/100 < i*(100+b)/100+c)ans++;
  }
  cout << ans << endl;
  

}
0