-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1B.cpp
More file actions
45 lines (44 loc) · 848 Bytes
/
Copy path1B.cpp
File metadata and controls
45 lines (44 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
vector<ll>v;
v.push_back(1);
ll c;
for (ll i = 1;; i++)
{
c = (i+1)/__gcd(i+1,v[i-1]);
c *= v[i-1];
// printf("%lld\n",c);
if(c<0){
break;
}
else
{
v.push_back(c);
}
}
int t;
scanf("%d", &t);
while (t--)
{
ll l;
scanf("%lld", &l);
int idx = lower_bound(v.begin(),v.end(),l)-v.begin();
// printf("%lld\n",l);
if(v[idx]==l){
printf("%d\n",idx+1);
printf("1");
for (int i = 2; i <= idx+1; i++)
{
printf(" %d",i);
}
printf("\n");
}
else
{
printf("-1\n");
}
}
}