自私数
来源:互联网 发布:席德梅尔的铁路 mac 编辑:程序博客网 时间:2024/04/28 08:43
一个数m可以分解为另一个数n及n的各位之和,例如87=75+7+5,不满足此条件的数叫做自私数,求10000以内的自私数
样例输出
1
3
5
7
9
20
31
42
53
64
|
| <– a lot more numbers
|
9903
9914
9925
9927
9938
9949
9960
9971
9982
9993
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <algorithm>using namespace std;bool a[10000];void solve( ){ for(int i=1;i<=10000;i++) { int t1,t2; t1=t2=i; while(t1) { t2+=t1%10; t1/=10; } a[t2]=true; } for(int i=1;i<=10000;i++) if(!a[i]) printf("%d\n",i);}int main( ){ memset(a,0,sizeof(a)); solve(); return 0;}
0 0
- 自私数
- 自私的数
- hdu-1128 自私的数
- 自私鬼
- 有些自私
- 自私无罪
- 面对自私
- 自私的我,自私的你
- 人的内在自私与外在自私
- 爱总是自私吗?
- 谈自私与无私
- 原谅我的自私
- 自私的阴谋
- 自私的代价
- 我很自私
- 我为什么这么自私?
- 自私的基因
- 我的自私
- 利用RecyclerView实现listview布局
- vtk Camera
- 使用functools.wraps完善装饰器
- Android Manifest.xml文件解析
- 深入Java字符串
- 自私数
- python比较函数min
- 个人简历
- 1.11
- Ajax的流程
- 指针、数组等直观例样
- SpringAOP2种配置方式(xml方式)
- Android 瀑布流列表(类似于ListView)
- Android-sharedUserId数据权限