标签:des style http color os strong 数据 io
Description
Input
Output
Sample Input
3 3 4 5
Sample Output
1 1 2
#include<stdio.h>
#include<string.h>
int pri(int x){
for(int i=2;i<x;i++)
if(x%i==0){
return 0;
break;
}
return 1;
}
int main(){
int z =0,p[155];
int a[10010],b[10010],n,m;
for(int i=2;i<=150;i++){
if(pri(i))p[z++] = i;
}
scanf("%d",&n);
while(n--){
//memset(a,0,sizeof(a));
scanf("%d",&m);
memset(a,0,sizeof(a));
a[0] =1;
for(int i=0;p[i]<=m;i++){
for(int j=0;j<=m;j++)
for(int k=0;k*p[i]+j<=m;k++)
b[k*p[i]+j] += a[j];
for(int j= 0;j<=m;j++){
a[j] = b[j];
b[j] = 0;
}
}
printf("%d\n",a[m]);
}
}标签:des style http color os strong 数据 io
原文地址:http://blog.csdn.net/yuanhanchun/article/details/38230303