본문 바로가기

Codeforces42

codeforces 1294A - Collecting Coins 1 2 3 4 5 6 7 8 9 10 11 12 13 14 t=int(input()) for i in range(t): nums=list(map(int,input().split())) n=nums[3] nums=nums[:3] threshold=max(nums)*3 ans =n-(threshold-sum(nums)) if ans 2022. 5. 12.
codeforces 785A - Anton and Polyhedrons 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import sys n=int(input()) ans=0 for i in range(n): s=input() if s == 'Tetrahedron': ans += 4 if s == 'Cube': ans += 6 if s == 'Octahedron': ans += 8 if s == 'Dodecahedron': ans += 12 if s == 'Icosahedron': ans += 20 print(ans) cs 2022. 5. 12.
codeforces 1030A - In Search of an Easy Problem 1 2 3 4 5 import sys n=int(input()) nums=list(map(int, sys.stdin.readline().split())) if sum(nums)>0 : print('HARD') else : print('EASY') cs 2022. 5. 11.
codeforces 1352A - Sum of Round Numbers 1 2 3 4 5 6 7 8 9 10 11 def sol(n): if len(n) == 1 : k = 1 else : k = len(n) - n.count('0') ans=[] for i in range(len(n)): if n[i] !='0' : ans.append(n[i]+'0'*(len(n)-i-1)) print(k) print(*ans) for i in range(int(input())): sol(str(input())) Colored by Color Scripter cs 2022. 5. 2.
codeforces 1335A - Candies and Two Sisters 1 2 3 4 5 6 def sol(n): if n%2 == 0 : ans = n//2 -1 else : ans = n//2 return ans for i in range(int(input())): print(sol(int(input()))) cs 2022. 5. 2.
codeforces 1154A - Restoring Three Numbers 1 2 3 4 5 6 def sol(input_list): a,b,c=input_list[3]-input_list[0],input_list[3]-input_list[1],input_list[3]-input_list[2] print(a,b,c) num_list=sorted(map(int, input().split())) sol(num_list) Colored by Color Scripter cs 2022. 4. 29.
codeforces 486A - Calculating Function 1 2 3 4 5 def sol(n): if n%2 == 0 : return (n//2) else: return sol(n-1)-n print(sol(int(input()))) cs 2022. 4. 29.
codeforces 155A - I_love_\%username\% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 n=int(input()) cnt = 0 nums=list(map(int, input().split())) strat_min=nums[0] strat_max=nums[0] for i in range(1,n) : if strat_min nums[i] : cnt+=1 strat_max=nums[i] print(cnt) cs 2022. 4. 29.
codeforces 977A - Wrong Subtraction 1 2 3 4 5 n, k = map(int, input().split()) for i in range(k): if n%10 == 0 : n//=10 else : n-=1 print(n) cs 2022. 4. 29.
codeforces 520A - Pangram 1 2 3 4 5 6 7 n=int(input()) s=input().lower() ans=[] for i in s: if i not in ans : ans.append(i) if 26 == len(ans) : print("YES") else : print("NO") cs 2022. 4. 29.
codeforces 1328A - Divisibility Problem 1 2 3 4 5 6 7 8 n=int(input()) for i in range(n): a , b = map(int, input().split()) if a%b == 0 : ans=0 elif a 2022. 4. 29.
codeforces 339A - Helpful Maths 1 2 3 4 5 s=sorted(list(map(int, input().split('+')))) ans=str(s[0]) for i in range(1, len(s)): ans+='+%d'%(s[i]) print(ans) Colored by Color Scripter cs 2022. 4. 29.