|
|
back to boardWhy WA? #include <stdio.h> #include <math.h> #include <iostream> int det(const double a,const double b) { int i = (int)a; double x = floor(a*10000)/10000; while (i<x)i++; if (i>=1&&i<b&&i>x)return 1; else return 0; } int main() { double p,q; int c; scanf("%lf%lf",&p,&q); p = 100 / (p); q = 100 / (q); for (c=1;det(c*q ,floor(c*p+0.00001)) == 0 ;c++); printf("%.0lf\n", c*q ); return 0; } |
|
|