Fibonacci
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
F1=1,F2=1,F3=2,F4=3,F5=5,
...
Fx = Fx-1+Fx-2
We want to know the Mth number which has K consecutive "0" at the end of Fx.
For example,
F15=610
It is the first number which has only one "0" at the end.
F300=222232244629420445529739893461909967206666939096499764990979600.
It is the second number which has two "0" at the end.
Of course, the Fx may be very large if M and K are big. So we only want to know the subscript of Fx (it means the "x" For a given M and K)
First line is the number of case x
The next x lines: Each line contains two integer number, K and M, divided by a space.
Print a integer number in a line, is the Mth number which has K consecutive 0s at the end of Fx. (You can believe the answer is smaller than 2^31);
1 1
2 2
2 5
300
900
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi (4*atan(1.0))
#define eps 1e-14
const int N=2e5+,M=4e6+,inf=1e9+,MOD=;
const ll INF=1e18+;
int a[]={,,,,,,,,,};
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int k,m;
scanf("%d%d",&k,&m);
if(k==)
printf("%d\n",((m-)/*+)*a[k]+((m-)%)*a[k]);
else
printf("%d\n",((m-)/*+)*a[k]+((m-)%)*a[k]);
}
return ;
}