-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Candies_and_Two_Sisters.cpp
94 lines (90 loc) · 1.84 KB
/
A_Candies_and_Two_Sisters.cpp
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
91
92
93
94
/*
#############################################
Author: hellgod_13
#############################################
*/
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define INF INT_MAX
#define ll long long
#define int long long
#define vi vector<int>
#define pii pair<int, int>
#define ld long double
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define f(i,a,b) for(int i=a;i<b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define max(a, b) ( \
{ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a > _b ? _a : _b; \
})
#define min(a, b) ( \
{ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a < _b ? _a : _b; \
})
//////////////////////////////////////////////////////////////////////////////
int power(int a, int b)
{
int res = 1ll;
while (b > 0)
{
if (b % 2ll)
res = (res * a) % MOD;
a = (a * a) % MOD;
b /= 2ll;
}
return res;
}
int GCD(int a, int b)
{
if (b == 0)
return a;
return GCD(b, a % b);
}
int fact(int n)
{
int res = 1;
for (int i = 2; i <= n; i++)
{
res = (res * i) % MOD;
}
return res % MOD;
}
bool comp(pair<string, int> a, pair<string, int> b)
{
if (a.second != b.second)
return a.second > b.second;
return a.first < b.first;
}
//////////////////////////////////////////////////////////////////////////////
void solve()
{
int x;
cin>>x;
if(x<=2){
cout<<"0";
}else{
cout<<((x-1)/2);
}cout<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tc = 1;
cin >> tc;
while (tc--)
{
solve();
}
}