2~6
원래 작성한 코드
a,b = input().split()
a= int(a); b=int(b)
if a>0 and b<10 and b!=0:
print(a/b)
다른 분들에 비해 시간이 오래 걸려서 찾아보니
a,b = map(int, input().split())
print(a+b)
-> 이 방식으로 작성하기
10430번
조건
if (x>=2 and y>=2 and z>=2) and (x<=1000 and y<=1000 and z<=1000):
-> 간소화 버전
if all(2 <= v <= 1000 for v in (x, y, z)):
근데 조건까지 추가하면 계속 틀렸다고 나와서 조건을 뺏더니 맞았다고 함,,
2588번
하드코딩식
x = int(input())
y = str(input())
print(x*int(y[2]))
print(x*int(y[1]))
print(x*int(y[0]))
print(x*int(y))
-> 간결하게 표현 다시
x = int(input())
y = str(input())
for num in range(len(y)):
print(x * int(y[len(y)-num-1]))
print(x*int(y))
10171번 아스키 고양이
print("\\ /\\")
print(" ) ( ')")
print("( / )")
print(" \(__)|")
백슬래시 유의
10171번 개 출력
print("|\_/|")
print("|q p| /}")
print('( 0 )"""\\')
print('|"^"` |')
print("||_/=\\\\__|")
'코딩 테스트 > Python' 카테고리의 다른 글
| 백준, Python) 심화 1단계 3003, 10988, 1157, 2941, 1316, 25206 (0) | 2025.04.16 |
|---|---|
| 백준, Python) 10809, 2675, 2908, 5622, 11718 (0) | 2025.04.09 |
| 백준, Python) 10870, 10871, 5597 (0) | 2025.04.08 |
| 백준, Python) 15552, 10951 (0) | 2025.04.07 |
| 백준, Python) 2단계 2525, 2480 (0) | 2025.04.04 |