-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeek_3.py
More file actions
76 lines (63 loc) · 1.94 KB
/
Week_3.py
File metadata and controls
76 lines (63 loc) · 1.94 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
#-*- coding: utf-8 -*-
import json
import sys
import Step_Question
class B_Week_3(Step_Question.Step):
# https://www.acmicpc.net/step/5
# https://www.acmicpc.net/step/6
def __init__(self):
self.step = Step_Question.Step()
self.initList()
def initList(self):
self.step.addList('1152', self.L1152)
self.step.addList('2577', self.L2577)
self.step.addList('8958', self.L8958)
self.step.addList('2920', self.L2920)
self.step.addList('10039', self.L10039)
def L1152(self):
input = raw_input()
input = input.strip()
print(input.count(' ') + 1)
def L2577(self):
a = int(raw_input()) * int(raw_input()) * int(raw_input())
n = [0]*10
while a > 0 :
n[a%10] += 1
a /= 10
for i in n:
print(i)
def L8958(self):
case = int(raw_input())
for d in range(0, case):
input = raw_input()
sum = 0
b = 0
for i in range(0, len(input)):
if input[i] == 'O':
b += 1
sum += b
else:
b = 0
print(sum)
def L2920(self):
# import sys
input = sys.stdin.readline().rstrip()
list = input.split(' ')
ret = ""
for i in range(1, len(list)):
if list[i] > list[i-1] and (ret == "" or ret == "ascending"):
ret = "ascending"
elif list[i] < list[i-1] and (ret == "" or ret == "descending"):
ret = "descending"
else:
ret = "mixed"
break
print(ret)
def L10039(self):
# import sys
sum = 0
for i in range(0, 5):
input = int(sys.stdin.readline().rstrip())
if input < 40 : sum += 40
else: sum += input
print(str(sum/5))