Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions 201902738/1013.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys, re

pattern = r'((100+1+)|(01))+'

n = int(sys.stdin.readline())
for _ in range(n):
s = sys.stdin.readline().strip()
if re.fullmatch(pattern, s):
print("YES")
else:
print("NO")
18 changes: 18 additions & 0 deletions 201902738/10851.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sys

N = int(sys.stdin.readline())

card_list = list(map(int, sys.stdin.readline().strip().split()))

M = int(sys.stdin.readline())
num_list = list(map(int, sys.stdin.readline().strip().split()))

card_dict = {}
for card in card_list:
card_dict[card] = 1

for num in num_list:
if num in card_dict:
print(1, end=' ')
else:
print(0, end=' ')
16 changes: 16 additions & 0 deletions 201902738/1149.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys

N = int(sys.stdin.readline())
RGB = []
PREV = ""

for i in range(N):
r, g, b = map(int, sys.stdin.readline().strip().split())
if i == 0:
RGB.append([r, g, b])
else:
RGB.append([r + min(RGB[i - 1][1], RGB[i - 1][2]),
g + min(RGB[i - 1][0], RGB[i - 1][2]),
b + min(RGB[i - 1][0], RGB[i - 1][1])])

print(min(RGB[N - 1]))
16 changes: 16 additions & 0 deletions 201902738/1205.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys

N, S, P = map(int, sys.stdin.readline().strip().split())
tmp = 0
if N != 0:
Scores = list(map(int, sys.stdin.readline().strip().split()))
Scores.append(S)
Scores.sort(reverse=True)
tmp = Scores.index(S) + 1
dup = Scores.count(S)
if tmp + dup - 1 > P:
print(-1)
else:
print(tmp)
else:
print(1)
11 changes: 11 additions & 0 deletions 201902738/1269.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

A, B = map(int, sys.stdin.readline().strip().split())

setA = set(list(map(int, sys.stdin.readline().strip().split())))
setB = set(list(map(int, sys.stdin.readline().strip().split())))

sub_setA = setA - setB
sub_setB = setB - setA

print(len(sub_setA) + len(sub_setB))
16 changes: 16 additions & 0 deletions 201902738/14425.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys

N, M = map(int, sys.stdin.readline().strip().split())

str_list = {}

for _ in range(N):
str_list[sys.stdin.readline().strip()] = 1

count = 0
for _ in range(M):
input = sys.stdin.readline().strip()
if input in str_list:
count += 1

print(count)
14 changes: 14 additions & 0 deletions 201902738/1620.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys

N, M = map(int, sys.stdin.readline().strip().split())

pokemon_dict = {}

for i in range(N):
pokemon = sys.stdin.readline().strip()
pokemon_dict[pokemon] = str(i + 1)
pokemon_dict[str(i + 1)] = pokemon

for _ in range(M):
input = sys.stdin.readline().strip()
print(pokemon_dict[input])
20 changes: 20 additions & 0 deletions 201902738/1764.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys

N, M = map(int, sys.stdin.readline().strip().split())

people = {}
for _ in range(N):
people[sys.stdin.readline().strip()] = 0

count = 0
for _ in range(M):
name = sys.stdin.readline().strip()
if name in people:
people[name] += 1
count += 1

people = sorted(people.items(), key=lambda x: x[0])
print(count)
for k, v in people:
if v > 0:
print(k)
13 changes: 13 additions & 0 deletions 201902738/25206.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys

score = {"A+": 4.5, "A0": 4.0, "B+": 3.5, "B0": 3.0, "C+": 2.5, "C0": 2.0, "D+": 1.5, "D0": 1.0, "F": 0.0}

sum_credits = 0
sum_grade = 0
for _ in range(20):
name, credit, rank = map(str, sys.stdin.readline().strip().split())
if rank != "P":
sum_credits += float(credit)
sum_grade += score[rank] * float(credit)

print("%.6f" % (sum_grade / sum_credits))
15 changes: 15 additions & 0 deletions 201902738/7785.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys

N = int(sys.stdin.readline())

people = {}
for _ in range(N):
name, option = sys.stdin.readline().strip().split()
if option == 'enter':
people[name] = 1
else:
del(people[name])

people = sorted(people.keys(), reverse=True)
for person in people:
print(person)