結果

問題 No.928 軽減税率?
ユーザー 👑 CleyLCleyL
提出日時 2019-11-22 22:30:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 753 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 69,820 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-11 04:14:37
合計ジャッジ時間 1,774 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
using namespace std;
int main(){
  int p,q,a;cin>>p>>q>>a;
  if(p <= q){
    cout << 1000000000 << endl;
    return 0;
  }
  //((100+q)/100)x+a = ((100+p)/100)x
  double A = (double)(100+q)/100;
  double B = (double)(100+p)/100;
  //Ax+a = Bx
  //a = x(B-A)
  double C = B-A;
  //a = xC
  int x = (double)a/C;
  //cout << fixed << setprecision(8);
  //cout << A << " " << B << " " << C << " " << x << endl;
  int ans = x;
  while(x*A+a-x*B < 2.0 && ans > 0){
    int X = x*A+a;
    int Y = x*B;
    if(X == Y){
      ans--;
      //cout << "!!" << x << ": " << x*A+a << " " << x*B << endl;
    }else{
      //cout << x << ": " << x*A+a << " " << x*B << endl;
    }
    x--;
  }
  cout << max(0,(int)ans) << endl;
}
0