Hi,
I’s going through the following problem of spoj
http://www.spoj.com/problems/GAMES/ but when I submit the code, it showa Wrong Answer and I think there is no mistake in my code.
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
if(b == 0)
return a;
return gcd(b, (a%b));
}
int main()
{
int t;
scanf("%d", &t);
while(t–)
{
float fl;
scanf("%f", &fl);
int a = fl*10000;
printf("%d\n", 10000/(gcd(a, 10000)));
}
return 0;
}