fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define MP make_pair
  5. #define PB push_back
  6. #define FOR(init,num,inc) for(int i=init; i<num;i=i+inc)
  7. #define N "\n"
  8. #define VII vector<int> :: iterator
  9. #define VILLI vector<long long int> :: iterator
  10. #define my_input(n) for(int i=0,a;i<n;i++) {cin>>a; v.PB(a);}
  11. #define sz size()
  12. #define fst first
  13. #define snd second
  14. #define FV 100005
  15. #define SX 1000005
  16. #define scint(a) scanf("%d", &a)
  17. //freopen("input.txt", "r", stdin);
  18. //freopen("output.txt", "w", stdout);
  19.  
  20. typedef int I;
  21. typedef long long int llint;
  22. typedef vector<int> VI;
  23. typedef vector<long long int > VLLI;
  24. typedef vector<string> VS;
  25. typedef set<int> SI;
  26. typedef set<long long int> SLLI;
  27. typedef set<string> SS;
  28.  
  29.  
  30. int main()
  31. {
  32. double p,q;
  33. cin>>p>>q;
  34. p*=100;
  35. q*=100;
  36. for(llint i=1; i<=300000000; i++ )
  37. {
  38. double x=((double)i*p);
  39. double y=((double)i*q);
  40. if(x/10000<(llint)(y/10000) && (llint)(y/10000)<y/10000) {cout<<i; return 0;}
  41. }
  42.  
  43. }
  44.  
Success #stdin #stdout 1.77s 4480KB
stdin
Standard input is empty
stdout
Standard output is empty