목록BOJ_백준 (123)
haju__log

https://www.acmicpc.net/problem/1934 1934번: 최소공배수 두 자연수 A와 B에 대해서, A의 배수이면서 B의 배수인 자연수를 A와 B의 공배수라고 한다. 이런 공배수 중에서 가장 작은 수를 최소공배수라고 한다. 예를 들어, 6과 15의 공배수는 30, 60, 90등이 있 www.acmicpc.net t=int(input()) for _ in range(t): a,b=map(int,input().split()) for i in range(max(a,b),a*b+1): if i%a==0 and i%b==0: print(i) break ✅==> 이렇게 풀었는데 시간초과됨 ㅎ ✅==>수정된 버전! t=int(input()) for _ in range(t): a,b=map(int,..
https://www.acmicpc.net/problem/10988 10988번: 팰린드롬인지 확인하기 첫째 줄에 단어가 주어진다. 단어의 길이는 1보다 크거나 같고, 100보다 작거나 같으며, 알파벳 소문자로만 이루어져 있다. www.acmicpc.net s=list(input()) cs=s[::-1] if s==cs: print(1) else: print(0)
https://www.acmicpc.net/problem/9506 9506번: 약수들의 합 어떤 숫자 n이 자신을 제외한 모든 약수들의 합과 같으면, 그 수를 완전수라고 한다. 예를 들어 6은 6 = 1 + 2 + 3 으로 완전수이다. n이 완전수인지 아닌지 판단해주는 프로그램을 작성하라. www.acmicpc.net while True: n=int(input()) if n ==-1: break l=list() for i in range(1,n//2+1): if n%i==0: l.append(i) if n==sum(l): print("%d = " %n, end="") for j in range(len(l)-1): print("%d + " %l[j], end="") print("%d" %l[-1]) els..
https://www.acmicpc.net/problem/9610 9610번: 사분면 2차원 좌표 상의 여러 점의 좌표 (x,y)가 주어졌을 때, 각 사분면과 축에 점이 몇 개 있는지 구하는 프로그램을 작성하시오. www.acmicpc.net n=int(input()) q1,q2,q3,q4,axis=0,0,0,0,0 for _ in range(n): x,y=map(int,input().split()) if x==0 or y==0 : axis+=1 elif x>0 : if y>0: q1+=1 else : q4+=1 else: #x0: q2+=1 else:q3+=1 print("Q1: %d\nQ2: %d\nQ3: %d\nQ4: %d\nAXIS: %d"%(q1,q2,q3,q4,axis))