joj2201

 2201: Prime and Decompounding


Result
TIME Limit
MEMORY Limit
Run Times
AC Times
JUDGE
3s
8192K
400
209
Standard
A positive interger except 1 can be decompounded to the sum of several prime numbers(include only one number). For exsample, four of the different forms in essence of the decompounding for 9 are: 9 = 2 + 5 + 2 = 2 + 3 + 2 + 2 = 3 + 3 + 3 = 2 + 7. Here the different forms in essence means that one expression can't be the same with others by exchange numbers in the it. Now do you know how many different decompounding forms in essence for any given number N.

Input and Output

The input will consist several lines, each line is a positive interger N(2 < N <= 330) for which output the anwser in a single line.

Sample Input

2
200

Sample Output

1
9845164

This problem is used for contest: 29 
Submit / Problem List / Status / Discuss
#include #include using namespace std; int prime[350]={0}; long long  c1[350]={0}; long long  c2[350]={0}; int main() {     int n=340;     for(int i=2;i<=n;i++)     {         for(int j=2;j*i<=n;j++)         {             prime[j*i]=1;         }     }     for(int i=0;i<=n/2;i++)     {         c1[i*2]=1;     }     for(int i=3;i

좋은 웹페이지 즐겨찾기