Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
why wrong answer!!!???#include<iomanip.h> int d[9000000]; int main() { int b[1500],a[20000],k=0,k3=0,k4=0,m,count=0,i,j; for(i=0;i<10000;i++) { a[i]=1; } for(i=0;i<1500;i++) { b[i]=0; } for(i=2;i<=10000;i++) { if(a[i]==1) { b[k++]=i; for(j=2;j<10000/i;j++) { a[j*i]=0; } } } for(j=0;j<k;j++) { for(i=j;i<k;i++) { d[k3++]=count+b[i]; count=d[k3-1]; } count=0; } cin>>m; while(m!=0) { for(i=0;i<k3;i++) { if(m==d[i]) { k4++; } } cout<<k4<<endl; k4=0; cin>>m; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator