-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDick_Jane.cpp
54 lines (46 loc) · 1.12 KB
/
Dick_Jane.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
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <ctime>
#include <map>
using namespace std;
ifstream fin("Dick_Jane.in");
ofstream fout("Dick_Jane.out");
int main()
{
while (true)
{
int s = -1, p, y, j;
fin >> s;
if (s == -1)
{
break;
}
fin >> p >> y >> j;
int last0, last1, last2;
for (int s0 = s; s0 <= s + 1; ++s0)
{
for (int p0 = p; p0 <= p + 1; ++p0)
{
for (int y0 = y; y0 <= y + 1; ++y0)
{
for (int j0 = j; j0 <= j + 1; ++j0)
{
last0 = (12 + j0 + s0 - 2 * y0) / 3;
last1 = last0 + y0;
last2 = last0 + p0;
}
}
}
}
fout << last1 << ' ' << last2 << ' ' << last0 << '\n';
}
return 0;
}