|
|
back to board!!!!USE ROUNDING!!! without round function i got WA #14. When i used it i got AC! #include <iostream> #include <cmath> using namespace std; double round(double d); int main() {double P, Q; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cin>>P>>Q; P/=100; Q/=100; int i=2; while(true) {double min=round(i*P); double max=round(i*Q); int C=int(max); if(C>min && C<max && C>=1) break; i++; } cout<<i; return 0; } //--------------------------------------------------------------------------- double round(double d) {return floor(d*10000+0.5)/10000; } Re: !!!!USE ROUNDING!!! Posted by Snayde 21 Apr 2013 18:04 thanks |
|
|