标签:stream art bool col gre str -- out tps
题目:
参考日神的 链接如下:https://blog.csdn.net/richenyunqi/article/details/79491648
代码如下:
#include<cstdio> #include<algorithm> #include<iostream> #include<vector> #include<unordered_set> using namespace std; main(){ vector<int>v; unordered_set<int>us; int n; cin>>n; int a; while(n--){ cin>>a; v.push_back(a); while(a!=1){ if(a%2==1) a=a*3+1; a/=2; us.insert(a); } } sort(v.begin(),v.end(),greater<int>()); bool first=true; for(auto i:v){ if(!us.count(i)) { cout<<(first?"":" ")<<i; first=false; } } return 0; }
标签:stream art bool col gre str -- out tps
原文地址:https://www.cnblogs.com/miao-xixixi/p/12571722.html