-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC_Physical_Education_Lesson.cpp
More file actions
90 lines (88 loc) · 1.71 KB
/
Copy pathC_Physical_Education_Lesson.cpp
File metadata and controls
90 lines (88 loc) · 1.71 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef unordered_map<ll, ll> mpp;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define fr(i, a, b) for (int i = a; i < b; i++)
#define get(a) \
for (auto &i : a) \
cin >> i
void wushangclan()
{
ll n, x;
cin >> n >> x;
ll a = n - x;
ll ans = 0;
ll ans1 = 0;
set<ll> st;
for (ll i = 1; i * i <= a; i++)
{
if (a % i != 0)
{
continue;
}
else
{
if (((i + 2) / 2) >= x && i != 1 && ((i + 2) % 2 == 0))
{
st.insert(i);
}
else
{
ans++;
}
if (i * i != a && ((a / i + 2) / 2) >= x && (((a / i + 2) % 2) == 0))
{
st.insert(a / i);
}
else
{
ans--;
}
}
}
a = n + x - 2;
for (ll i = 1; i * i <= a; i++)
{
if (a % i != 0)
{
continue;
}
else
{
if (((i + 2) / 2) >= x && i != 1 && ((i + 2) % 2 == 0))
{
st.insert(i);
}
else
{
ans++;
}
if (i * i != a && ((a / i + 2) / 2) >= x && ((a / i + 2) % 2 == 0))
{
st.insert(a / i);
}
else
{
ans--;
}
}
}
cout << st.size() << endl;
}
int main()
{
int t;
cin >> t;
while (t--)
{
wushangclan();
}
return 0;
}