|
|
back to boardWA#6, help me plz!!! #include <bits/stdc++.h> using namespace std; float p,q,t1,t2,t3,l1,l2; int main() { cin>>p>>q; for(int i=1; i<=1000000; i++){ t1=(p*(float)i)/(float)100; t2=(q*(float)i)/(float)100; l1=(int)t1; l2=(int)t2; if(l1==t1||l2==t2||l1!=l2){ if(l1!=t1) l1=l1+1; for(int j=l1; j<=l2; j++){ t3=((float)j/(float)i)*(float)100; if(p-0.000001<t3&&t3<q+0.000001){ cout<<i; return 0; } } } } } |
|
|