Matryoshka Dolls Gym - 102267C | Soltution 2

Matryoshka Dolls Gym – 102267C | Soltution

Matryoshka Dolls are Russia’s most popular souvenirs. They are sets of wooden figurines of decreasing size placed one inside another, though they have the same exact shape.

Our Matryoshka Doll is known to have an integer size SS which is the largest doll size in the collection, and each doll should have size XX times less than the doll that holds it(size of the doll≤size of the doll that holds itXsize of the doll≤size of the doll that holds itX).

Given SS and XX, What is the maximum number of dolls that can be nested inside each other.

Matryoshka Dolls Gym - 102267C | Soltution 3

Input

The first and only line contains 22 integers S,XS,X(1≤S≤1091≤S≤109 , 2≤X≤1092≤X≤109).

Output

Output one integer, the maximum number of dolls.

Example Input

10 2

Output

4

Solve Source Code

#include<stdio.h>
int main()
{
    int c=0,s,x;
    scanf("%d%d",&s,&x);
    while(s){c++;s/=x;}
    printf("%d",c);
    return 0;
}