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 |
AC 了的,,请看#include <stdio.h> #include <string.h> #define lenth 10003 int selfnum[lenth]={0}; void done(); int main() { done(); for(int i=1;i<10000;i++) { if(selfnum[i]==0) printf("%d\n",i); else continue; } return 0; } void done() { int sum,yu; selfnum[0]=1; selfnum[1]=0; selfnum[2]=1; for(int i=2;i<lenth;i++) { yu=i; sum=i; while(yu) { sum+=(yu%10); yu/=10; } if(sum<lenth) selfnum[sum]=1; else continue; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator