본문 바로가기

Codeforces42

codeforces 1351A - A+B (Trial Problem) 1 2 3 4 5 import sys for i in range(int(input())): a,b=map(int,sys.stdin.readline().split()) print(a+b) Colored by Color Scripter cs 2022. 6. 7.
codeforces 677A - Vanya and Fence 1 2 3 4 5 6 7 8 9 10 11 def sol(nums,h): ans = 0 for i in nums: if i > h: ans += 2 else: ans += 1 print(ans) n,h=map(int,input().split()) nums=list(map(int, input().split())) sol(nums,h) cs 2022. 5. 31.
codeforces 96A - Football 1 2 3 4 5 6 7 8 def sol(s): target1='0000000' target2 = '1111111' if target1 in s or target2 in s: print("YES") else : print("NO") sol(input()) cs 2022. 5. 31.
codeforces 617A - Elephant 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def sol(n): ans=0 while n>0: if n>=5: n-=5 elif n>=4: n-=4 elif n>=3: n-=3 elif n>=2: n-=2 elif n>=1: n-=1 ans+=1 return ans print(sol(int(input()))) cs 2022. 5. 31.
codeforces 1686A - Everything Everywhere All But One 1 2 3 4 5 6 7 8 9 10 def sol(nums): n=len(nums) return sum(nums)/n for _ in range(int(input())): num_length=int(input()) nums=list(map(int, input().split())) if sol(nums) in nums : print("YES") else : print("NO") cs 2022. 5. 30.
codeforces 978A - Remove Duplicates 1 2 3 4 5 6 7 8 9 10 def sol(n,nums): ans=[] for i in range(1,n+1): if nums[-i] not in ans: ans.append(nums[-i]) print(len(ans)) print(*ans[::-1]) n=int(input()) nums=list(map(int,input().split())) sol(n,nums) cs 2022. 5. 26.
codeforces 1206A - Choose Two Numbers 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(nums1,nums2): for i in nums1: for j in nums2: if i+j not in nums1 and i+j not in nums2 : ans1,ans2=i,j print(ans1,ans2) n1=int(input()) nums1=list(map(int, input().split())) n2=int(input()) nums2=list(map(int, input().split())) sol(nums1,nums2) Colored by Color Scripter cs 2022. 5. 26.
codeforces 118A - String Task 1 2 3 4 5 6 7 8 9 10 11 12 13 vowels=['a','e','i','o','u','y'] def sol(s): ans='' s=s.lower() for i in vowels: s=s.replace(i,'') for i in s: ans+='.' ans+=i return ans s=input() print(sol(s)) cs 2022. 5. 25.
codeforces 1A - Theatre Square 1 2 3 4 5 from math import ceil def sol(n,m,a): return(ceil(n/a)* ceil(m/a)) n,m,a=map(int,input().split()) print(sol(n,m,a)) cs 2022. 5. 25.
codeforces 231A - Team 1 2 3 4 5 6 7 8 9 10 11 def sol(nums): if sum(nums)>=2 : return 1 else : return 0 n=int(input()) cnt=0 for _ in range(n): nums=list(map(int,input().split())) cnt+=sol(nums) print(cnt) cs 2022. 5. 25.
codeforces 1669A - Division? 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(n): if n >= 1900 : print("Division 1") elif n >= 1600 : print('Division 2') elif n >= 1400: print('Division 3') else : print('Division 4') n=int(input()) for _ in range(n): sol(int(input())) cs 2022. 5. 24.
codeforces 1619A - Square String? 1 2 3 4 5 6 n=int(input()) for i in range(n): s=input() len_string=len(s) if len_string%2 ==0 and s[:len_string//2]==s[len_string//2:] : print("YES") else : print("NO") Colored by Color Scripter cs 2022. 5. 12.