-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2-3Moves.cpp
More file actions
39 lines (38 loc) · 765 Bytes
/
2-3Moves.cpp
File metadata and controls
39 lines (38 loc) · 765 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
#include <iostream>
using namespace std;
int main()
{
int samples;
cin >> samples;
while (samples--)
{
long long int point;
cin >> point;
int store2 = point % 2;
int store3 = point % 3;
if (point == 0)
{
cout << 0 << endl;
}
else if (store3 == 0)
{
cout << point / 3 << endl;
}
else if (store3 == 2)
{
cout << (point / 3) + 1 << endl;
}
else if (store3 == 1)
{
if (store2 == 1)
{
cout << (point / 3) + 2 << endl;
}
else
{
cout << (point / 3) + 1 << endl;
}
}
}
return 0;
}