Submission #15354

# Submission time Handle Problem Language Result Execution time Memory
15354 2015-07-12T06:36:10 Z wlgns88 피보나미얼 (kriii3_V) C++
0 / 74
0 ms 1720 KB
#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));
	}
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -