#include<iostream>
#include<fstream>
#include<map>
#include<vector>
using namespace std;
int main()
{
freopen("in.txt","r",stdin);
map<int,int> cache;
int t;
cin>>t;
while(t--){
int x;
cin>>x;
while(x!=1){
cache[x]++;
if(x&01){
x=(3*x+1)/2;
}else{
x=x/2;
}
}
}
bool flag=false;
for(map<int,int>::reverse_iterator itr=cache.rbegin();itr!=cache.rend();++itr){
if(itr->second==1){
if(flag){
cout<<" ";
}
cout<<itr->first;
flag=true;
}
}
}
1005
最新推荐文章于 2020-07-21 17:38:00 发布