摘要: 《算法竞赛入门经典》笔记1--笔记为书中的例题源码和本人做的一些课后题的解答 //2-2daffodil水仙花数 #include <stdio.h>int main(void){ int num,t; int temp = 0; int j = 3; for(int i = 100;i <= 999; i++) { t= i; while(j--) { num = t%10;//依次求出各个位数上的值 temp += num *num *num; t = t/10; } j = 3; if(temp == i) printf("%d\n",temp); 阅读全文
posted @ 2011-04-09 11:43 xfate 阅读(358) 评论(0) 推荐(0) 编辑