| ||||||||||
| 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 | |||||||||
哈哈。。用set做真是简单啊!!先是由于set可以对加入的数排序,并且保证没有相同的数(multiset可以相同),所以问题就简单了。。。下面是代码(已被注释)
// #include <iostream>
// #include <set>
//
// using namespace std;
//
// int GetDigitsum(int a)
// {
// int sum=0;
// while (a)
// { sum+=a%10;
// a/=10;
// }
// return sum;
//
// }
//
//
//
// int main()
// {int i,t;
// set<int> IntSet;
// for (i=1;i<=10000;i++)
// {t=i+GetDigitsum(i); //先是把非SelfNumber存在set里面
// IntSet.insert(t);
// }
//
// for(i=1;i<=10000;i++)
// {if(IntSet.find(i)==IntSet.end())
///////////////////////利用set自带的find函数判断有没有,如果没有则输出
// cout<<i<<endl;
// }
//
// return 0;
// }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator