본문 바로가기

알고리즘/백준39

[Python] 백준 10951번 - A+B - 4 https://www.acmicpc.net/problem/10951 10951번: A+B - 4 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net a, b = map(int, input().split()) while (a, b): try: print(a+b) a, b = map(int, input().split()) except EOFError: break 2020. 6. 9.
[Python] 백준 10952번 - A+B - 5 https://www.acmicpc.net/problem/10952 10952번: A+B - 5 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net import sys a, b = map(int, sys.stdin.readline().split()) while a and b: print(a+b) a, b = map(int, sys.stdin.readline().split()) 2020. 6. 9.
[Python] 백준 10871번 - X보다 작은 수 https://www.acmicpc.net/problem/10871 10871번: X보다 작은 수 첫째 줄에 N과 X가 주어진다. (1 ≤ N, X ≤ 10,000) 둘째 줄에 수열 A를 이루는 정수 N개가 주어진다. 주어지는 정수는 모두 1보다 크거나 같고, 10,000보다 작거나 같은 정수이다. www.acmicpc.net import sys N, X = map(int, sys.stdin.readline().split()) A = map(int, sys.stdin.readline().split()) for i in A: if i < X: print(i, end=' ') else: continue 2020. 6. 9.
[Python] 백준 2439번 - 별 찍기 - 2 https://www.acmicpc.net/problem/2439 2439번: 별 찍기 - 2 첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제 하지만, 오른쪽을 기준으로 정렬한 별(예제 참고)을 출력하시오. www.acmicpc.net import sys n = int(sys.stdin.readline()) for i in range(1, n+1): a = "*" * i print(a.rjust(n)) 2020. 6. 9.
[Python] 백준 2438번 - 별 찍기 - 1 https://www.acmicpc.net/problem/2438 2438번: 별 찍기 - 1 첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제 www.acmicpc.net for i in range(1, int(input())+1): print("*" * i) 2020. 6. 9.