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. double rnd(double xx)
  30. {
  31.  
  32. stringstream ss;
  33. ss << fixed;
  34. ss.precision(2); // set # places after decimal
  35. ss << xx;
  36. double hi;
  37. ss>>hi;
  38. return hi;
  39. }
  40.  
  41. int main()
  42. {
  43. double p,q;
  44. cin>>p>>q;
  45.  
  46. for(llint i=1; i<=1e7; i++ )
  47. {
  48. double x=((double)i*p)/100.00;
  49. x=rnd(x);
  50. double xn=(llint)x+1;
  51. double ex=((xn-x)/(double)i)*100.00;
  52.  
  53. if (ex+p<q)
  54. {
  55. cout<<i;
  56. return 0;
  57. }
  58. }
  59.  
  60. }
Time limit exceeded #stdin #stdout 5s 4536KB
stdin
Standard input is empty
stdout
Standard output is empty