-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_1_Non-alternating_Deck_easy_version.cpp
70 lines (60 loc) · 1.47 KB
/
A_1_Non-alternating_Deck_easy_version.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
// GOOD LUCK
// | | | k
// ( | k
// | | |k
// ) | k
// | | • | k
// DATE: 05-02-2023
// TIME: 18-42-01
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sq(a) (a) * (a)
#define all(a) a.begin(), a.end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < n; i++)
// #define forn(i,n) for (const int &n : numbers)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define dep(i, b, a) for (int i = b; i >= a; i--)
// #************ KEEP IN MIND ************#
// READ THE QUESTION PROPERLY [Many times if required]
// FIRST SOLVE ON PAPER AND GET THE CORRECT APPROACH THEN ONLY START CODING
//[This will save alot of time as well as lower incorrect submissions]
// DON'T GET STUCK ON ONE APPROACH [Try to think differently]
// TRY TO SOLVE SUBPROBLEMS OR FOR N==2,3,4.. FIRST THEN YOU MIGHT START SEEING SOMETHING
// DON'T REPEAT THE SAME MISTAKES DONE IN PREVIOUS CONTESTS
// #************ KEEP IN MIND ************#
void solve()
{
int n, a = 0, b = 0, k = 1;
cin >> n;
while (2 * k - 1 <= n)
{
a = a + 2 * k - 1;
k++;
}
k = 1;
while (2 * k <= n)
{
b = b + 2 * k;
k++;
}
cout << a << " ";
cout << b << endl;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(NULL);
ll t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}