# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15436 |
2015-07-12T07:39:56 Z |
wlgns88 |
피보나미얼 (kriii3_V) |
C++ |
|
0 ms |
1084 KB |
#include <stdio.h>
long long int chk=0;
bool getBit(long long int num,long long int i){
return (num&(1<<i));
}
void setBit(long long int& num,long long int i){
num = num|(1<<i);
}
long long int RecursiveFibonacci(long long int num,long long int& fibonamial){
if(num==0 || num==1){
return num;
}else if(num>=2){
long long int result = RecursiveFibonacci(num-1,fibonamial) + RecursiveFibonacci(num-2,fibonamial);
if ( getBit(chk,num) == false ) {
fibonamial = fibonamial*result;
setBit(chk,num);
}
return result;
}
}
long long int getDivMax(long long int target,long long int n){
unsigned long long i=0;
while(target%n==0){
target=target/n;
i++;
}
return i;
}
int main()
{
chk = 0;
long long int n,p;
scanf("%lld %lld",&n,&p);
long long int fibonamial=1;
RecursiveFibonacci(n,fibonamial);
for(long long int i=1;i<=p-1;i++){
printf("%lld\n",getDivMax(fibonamial,i+1));
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |