您的位置:首页 > 其它

zoj 1760 Doubles

2011-12-28 12:49 204 查看
#include "iostream"
#include "set"
using namespace std;

int main()
{
set<int> s;
set<int>::iterator it;
int temp;
while (cin >> temp && temp != -1)
{
if (temp != 0)
s.insert(temp);//放进容器中进行自动排序!
else
{
int count = 0;
for (it = s.begin(); it != s.end(); it++)
if (s.find((*it) * 2) != s.end())//在容器中查找是否存在!
count++;
cout << count << endl;
s.clear();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: