#include <stdio.h>
#include <iostream>
int RecursiveFibonacci(int num){
if(num==0 || num==1){
return num;
}else if(num>=2){
unsigned long long result = RecursiveFibonacci(num-1) + RecursiveFibonacci(num-2);
return result;
}
}
unsigned long long Fibonamial(int num){
unsigned long long result = 1;
for(int i=1;i<=num;i++){
result=RecursiveFibonacci(i)*result;
//printf("%d> %u\n",i,result);
}
return result;
}
int getDivMax(unsigned long long target,int n){
int i=0;
//printf("%u,%d\n",target,n);
while(target%n==0){
target=target/n;
i++;
}
return i;
}
int main()
{
int n,p;
scanf("%d %d",&n,&p);
unsigned long long fibo = Fibonamial(n);
for(int i=1;i<=p-1;i++){
printf("%d\n",getDivMax(fibo,i+1));
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1720 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |