File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ import sys
2+ import math
3+ input = sys .stdin .readline
4+
5+ """
6+ 준형: BNP
7+ - 첫 날 최대치를 사고, 절대 매도하지 않는다.
8+
9+ 성민: Timing
10+ - 전량 매수 Or 전량매도
11+ - 3일 연속 가격이 전일대비 상승할 경우 -> 전량매도. (전일과 오늘의 주가가 동일한 것은 가격 상승 아님)
12+ - 3일 연속 가격이 전일대비 하락하는 경우 -> 전량 매수. (전일과 오늘의 주가가 동일한 것은 가격 하락 아님)
13+
14+ 두 사람에게 주어진 현금은 동일하다.2021년 1월 14일의 자산이 더 많은 사람이 승리한다.
15+ 준현이가 이기면 BNP, 성민이가 이기면 TIMING, 동점일 경우 SAMESAME이다.
16+ 자산 = 현금 + 1월 14일 주가 * 주식 수
17+
18+ 준형: 10주 -> 0 + 38 * 10 = 380 / 1주. 14원
19+ 성민:
20+ """
21+
22+ money = int (input ())
23+ prices = list (map (int , input ().split ()))
24+
25+ # 준현이 (BNP)
26+ jh_cash = money
27+ jh_stock = 0
28+ for price in prices :
29+ if jh_cash >= price :
30+ jh_stock += jh_cash // price
31+ jh_cash = jh_cash % price
32+ jh_total = jh_cash + jh_stock * prices [- 1 ]
33+
34+ # 성민이 (TIMING)
35+ sm_cash = money
36+ sm_stock = 0
37+ for i in range (3 , 14 ):
38+ # 3일 연속 상승
39+ if prices [i - 3 ] < prices [i - 2 ] < prices [i - 1 ]:
40+ sm_cash += sm_stock * prices [i ]
41+ sm_stock = 0
42+ # 3일 연속 하락
43+ elif prices [i - 3 ] > prices [i - 2 ] > prices [i - 1 ]:
44+ can_buy = sm_cash // prices [i ]
45+ sm_stock += can_buy
46+ sm_cash -= can_buy * prices [i ]
47+ sm_total = sm_cash + sm_stock * prices [- 1 ]
48+
49+ # 결과 출력
50+ if jh_total > sm_total :
51+ print ("BNP" )
52+ elif jh_total < sm_total :
53+ print ("TIMING" )
54+ else :
55+ print ("SAMESAME" )
You can’t perform that action at this time.
0 commit comments