목록전체 글 (234)
honey_pot

def lcm(a, b): return a * b // gcd(a, b) def gcd(a, b): while b: a, b = b, a % b return a t = int(input()) for _ in range(t): A, B = map(int, input().split()) print(lcm(A, B)) 유클리드 호제법을 이용해서 최대공약수를 구하고 그것을 이용해서 최소공배수를 구한다.

n = int(input()) res1=res0=0 for _ in range(n): a = int(input()) if a==1: res1+=1 else: res0+=1 if res1 > res0: print("Junhee is cute!") else:print("Junhee is not cute!")

v = int(input()) vote = input() A=B=0 for i in range(len(vote)): if vote[i]=='A': A += 1 else: B+=1 if A > B: print("A") elif A ==B: print("Tie") else: print("B")

n = int(input()) for _ in range(n): r, e, c = map(int, input().split()) if r > e-c: print("do not advertise") elif r == e-c: print("does not matter") else: print("advertise")

res = 10 a = input() for i in range(1, len(a)): res +=10 if a[i-1] != a[i] else 5 print(res) 그릇의 모양이 같으면 5, 다르면 10을 더해주는 문제이다.

a = input() pal = 1 for i in range(len(a)//2): # 0부터 문자열 길이의 절반만큼 반복 if a[i] == a[-1-i]: pass else: pal =0 print(pal) 투 포인터를 이용하는 팰린드롬 문제