Submission #15554

# Submission time Handle Problem Language Result Execution time Memory
15554 2015-07-12T12:31:01 Z abcd123 피보나미얼 (kriii3_V) C
0 / 74
0 ms 8892 KB
#include<stdio.h>
 
long long cache[1000000];
 
long long f(int x)
{
    if(x==1||x==2)
    {
        cache[x] = 1;
        return cache[x];
    }
    else
    {
        if(cache[x]==0){
            cache[x] = f(x-1) + f(x-2);
            return cache[x];
        }
        else
            return cache[x];
    }
}
 
void main()
{
    int num,p,i;
    long long sum = 1, test;
    int arr[100] = {0,};
 
    scanf("%d %d",&num,&p);
     
    for(i=1;i<=num;i++)
        sum *= f(i);
 
    for(i=1;i<=p-1;i++){
        test = sum;
        while(1){
            if(test%(i+1) == 0){
                arr[i] += 1;
                test = test/(i+1);
            }
            if(test%(i+1) != 0)
                break;
        }
    }
 
    for(i=1;i<=p-1;i++)
        printf("%d\n",arr[i]);
     
    //system("PAUSE");
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 8892 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -