zoj 1760 Doubles

来源:互联网 发布:查看数据库内容 编辑:程序博客网 时间:2024/05/17 09:00
#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();}}}

原创粉丝点击