File tree 2 files changed +55
-0
lines changed
2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ g = int (input ())
2
+ a , b = 1 , 2 #기억한 몸무게, 현재 몸무게
3
+
4
+ find = False
5
+ while a < g and b < g :
6
+ if b ** 2 - a ** 2 == g :
7
+ print (b )
8
+ find = True
9
+ a += 1
10
+ elif (b ** 2 - a ** 2 ) > g :
11
+ a += 1
12
+ else :
13
+ b += 1
14
+
15
+ if not find :
16
+ print (- 1 )
17
+
18
+ #시간이 왜 이렇게 오래 걸리는지?
Original file line number Diff line number Diff line change
1
+ def rab (node ):
2
+ if node == '.' :
3
+ return
4
+ print (node , end = '' )
5
+ rab (tree [node ][0 ])
6
+ rab (tree [node ][1 ])
7
+
8
+
9
+ def arb (node ):
10
+ if node == '.' :
11
+ return
12
+ arb (tree [node ][0 ])
13
+ print (node , end = '' )
14
+ arb (tree [node ][1 ])
15
+
16
+
17
+ def abr (node ):
18
+ if node == '.' :
19
+ return
20
+ abr (tree [node ][0 ])
21
+ abr (tree [node ][1 ])
22
+ print (node , end = '' )
23
+
24
+
25
+ n = int (input ())
26
+ tree = {}
27
+
28
+ for _ in range (n ):
29
+ root , left , right = input ().split ()
30
+ tree [root ] = [left , right ]
31
+
32
+ #print(tree)
33
+ rab ('A' )
34
+ print ('' )
35
+ arb ('A' )
36
+ print ('' )
37
+ abr ('A' )
You can’t perform that action at this time.
0 commit comments