-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path49088.cpp
50 lines (47 loc) · 873 Bytes
/
49088.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
// 의좋은 형제
// 2021.10.21
#include <iostream>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int k;
cin >> k;
int num = 0;
for (int i = 1; i <= k; i++)
{
if (i % 2 == 1)
{
if (n % 2 == 1)
{
num = n / 2 + 1;
m += num;
n -= num;
}
else
{
num = n / 2;
m += num;
n -= num;
}
}
else
{
if (m % 2 == 1)
{
num = m / 2 + 1;
n += num;
m -= num;
}
else
{
num = m / 2;
n += num;
m -= num;
}
}
}
cout << n << " " << m << endl;
return 0;
}