求救
  • 板块灌水区
  • 楼主54188_you_Dad
  • 当前回复5
  • 已保存回复5
  • 发布时间2023/9/8 19:35
  • 上次更新2023/11/2 22:18:39
查看原帖
求救
818236
54188_you_Dad楼主2023/9/8 19:35

题目

UKE

#include <bits/stdc++.h>
using namespace std;
#define _ " "
#define endl "\n"
#define int long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
vector<int> a;
signed main()
{
	IOS;
	for(int i=0;i<60;i++)
	{
		for(int j=i+1;j<60;j++)
		{
			for(int k=j+1;k<60;k++)
			{
				int x = (1ll<<i)+(1ll<<j)+(1ll<<k);
				a.push_back(x);
			}
		}
	}
	sort(a.begin(),a.end());
	int q;
	cin>>q;
	while(q--)
	{
		int x;
		cin>>x;
		if(x<=6) cout<<-1;
		else cout<<*prev(upper_bound(a.begin(),a.end(),x));
		cout<<endl;
	}
	return 0;
}

2023/9/8 19:35
加载中...