-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path15953.cpp
More file actions
63 lines (59 loc) · 964 Bytes
/
15953.cpp
File metadata and controls
63 lines (59 loc) · 964 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// 15953. 상금 헌터
// 2019.05.22
// 구현
#include<iostream>
using namespace std;
int aReward[7] = { 0,5000000,3000000,2000000,500000,300000,100000 }; // 1회 보상
int bReward[6] = { 0,5120000,2560000,1280000,640000,320000 }; // 2회 보상
int main()
{
int t;
cin >> t;
while (t > 0)
{
t--;
int a, b; // 등수 입력
cin >> a >> b;
int ans = 0;
int aCnt = 1;
if (a != 0) // 0일땐 무시
{
while (1)
{
a -= aCnt;
if (a <= 0) // 상금 획득
{
ans += aReward[aCnt];
break;
}
aCnt++;
if (aCnt == 7) // 무관
{
break;
}
}
}
int bCnt = 1;
int cnt = 1; // b의 인원수를 계산하는 변수
if (b != 0) // 0일땐 무시
{
while (1)
{
b -= bCnt;
if (b <= 0) // 상금 획득
{
ans += bReward[cnt];
break;
}
bCnt *= 2;
cnt++;
if (cnt == 6) // 무관
{
break;
}
}
}
cout << ans << endl;
}
return 0;
}