목록BOJ_백준 (122)
haju__log
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))
https://www.acmicpc.net/problem/5086 5086번: 배수와 약수 각 테스트 케이스마다 첫 번째 숫자가 두 번째 숫자의 약수라면 factor를, 배수라면 multiple을, 둘 다 아니라면 neither를 출력한다. www.acmicpc.net while True: a,b=map(int,input().split()) if a==0 and b==0: break if b%a==0: print("factor") elif a%b==0: print("multiple") else: print("neither")