-
Notifications
You must be signed in to change notification settings - Fork 0
/
20546.cpp
44 lines (37 loc) · 979 Bytes
/
20546.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
#include <iostream>
using namespace std;
int main() {
int money = 0;
int arr[15];
cin >> money;
int s_money = money, j_money = money, s_stock = 0, j_stock = 0;
for (int i = 1; i < 15; ++i) {
cin >> arr[i];
}
for (int i = 1; i < 15; ++i) {
if (arr[i] <= j_money && j_money != 0) {
j_stock += j_money / arr[i];
j_money = j_money % arr[i];
}
}
for (int j = 4; j < 15; ++j) {
if ((arr[j - 3] < arr[j - 2]) && (arr[j-2] < arr[j-1]) && (arr[j - 1] < arr[j]) && s_stock > 0) { // Ç® ¸Åµµ
s_money += arr[j] * s_stock;
s_stock = 0;
}
if ((arr[j - 3] > arr[j - 2]) && (arr[j - 2] > arr[j - 1]) && (arr[j - 1] > arr[j]) && arr[j] < s_money) { //Ç® ¸Å¼ö
s_stock += s_money / arr[j];
s_money = s_money % arr[j];
}
}
if (arr[14] * j_stock + j_money > arr[14] * s_stock + s_money) {
cout << "BNP";
}
else if (arr[14] * j_stock + j_money < arr[14] * s_stock + s_money) {
cout << "TIMING";
}
else {
cout << "SAMESAME";
}
return 0;
}