Skip to main content

solution of ATOMS - Atoms in the Lab on spoj

SOLUTION-ATOMS - Atoms in the Lab

#include <stdio.h>
#include<math.h>
int main()
{
    long long int p,n,k,m,i;
    scanf("%lli",&p);
    while(p--)
    {
        scanf("%lld %lld %lld",&n,&k,&m);
        i=1;
        while(pow(k,i)<=(m/n))
         i++;
        printf("%lld\n",i-1);
    }
    return 0;
}

Comments