-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathback_1024.cpp
More file actions
48 lines (42 loc) · 776 Bytes
/
back_1024.cpp
File metadata and controls
48 lines (42 loc) · 776 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
46
47
48
#include <iostream>
using namespace std;
int main()
{
long int n;
int L;
cin >> n >> L;
long int s = -1;
long int e = -1;
for (long int i = L; i <= 100; i++)
{
if (i % 2 == 1)
{
if (n % i == 0)
{
s = n / i - i / 2;
e = n / i + i / 2;
break;
}
}
else
{
if (n % i == i / 2)
{
s = n / i - i / 2 + 1;
e = n / i + i / 2;
break;
}
}
}
if (s < 0)
cout << -1 << endl;
else
{
for (long int i = s; i <= e; i++)
{
cout << i << " ";
}
cout << endl;
}
return 0;
}