Submission #15436

#TimeUsernameProblemLanguageResultExecution timeMemory
15436wlgns88피보나미얼 (kriii3_V)C++98
0 / 74
0 ms1084 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...