Problem Description
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 X 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 it X).
Given S and X, What is the maximum number of dolls that can be nested inside each other.
Input
The first and only line contains 2 integers S,X(1≤S≤109,2≤X≤109).
Output
Output one integer, the maximum number of dolls.
Examples
Input
10 2
Output
4
题意:给出 S、X 两个数,S 代表尺寸最大的套娃,如果想在一个套娃里放一个套娃,要求当前套娃的尺寸小于等于上一个套娃的尺寸除以 X
思路:暴力模拟即可
Source Program
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
#define Pair pair<int,int>
const int MOD = 1E9+7;
const int N = 10000000+5;
const int dx[] = {1,-1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
int main() {
LL n,m;
scanf("%lld%lld",&n,&m);
LL res=0;
while(n>0) {
n/=m;
res++;
}
printf("%lld\n",res);
return 0;
}