언어는 과-학인가요?/python 파이썬

백준 1단계 문제풀이

이원자 탄소 2022. 7. 4. 02:17
728x90

2557

print('Hello World!')

 

10718

print('강한친구 대한육군\n강한친구 대한육군')

 

10171

print('\\    /\\\n )  ( \')\n(  /  )\n \\(__)|')

역슬래쉬 (\) 와 따음표 (",') 앞에는 \를 붙여줍니다.

 

10172

print('|\\_/|\n|q p|   /}\n( 0 )\"\"\"\\\n|\"^\"`    |\n||_/=\\\\__|')

10171과 동일

 

1000

A,B=input().split()
print(int(A)+int(B))

.split()으로 A 와 B에 input 값을 나누어 넣는다

A와 B를 int형으로 바꿔 프린트한다

 

1001

A,B=input().split()
print(int(A)-int(B))

1000번과 동일 

int 형으로 바꾼 두 input값 사이에 부호만 바꿈.

 

10998

A,B=input().split()
print(int(A)*int(B))

1000번과 동일

 

1008

A,B=input().split()
print(int(A)/int(B))

1000번과 동일

 

10869

A,B=input().split()
print(int(A)+int(B))
print(int(A)-int(B))
print(int(A)*int(B))
print(int(int(A)/int(B)))
print(int(A)%int(B))

나누기 할때는 나누면 정수로 안나오는 경우도 있기에 int를 다시한번 더 붙여주는

 

10926

A=input()
print(A+'??!')

input형태를 안알려줘도 알아서 되는 갓이썬

 

18108

A=input()
print(int(A)-543)

꼭 형태를 int로 바꿔줍시다

 

10430

A,B,C=input().split()
A=int(A)
B=int(B)
C=int(C)
print((A+B)%C)
print(((A%C) + (B%C))%C)
print((A*B)%C)
print(((A%C)*(B%C))%C)

A, B, C를 인트로~

 

2588

A = int(input())
B = input()
for i in range(3, 0, -1) :
    print(A * int(B[i - 1]))
print(A * int(B))

A 는 정수니까 int형으로 받고, B는 그냥 문자열로 저장해 준다. 

문자열 (배열)은 이제 for반복문 안에 들어가서 2번째 배열부터 0번째 배열까지 순서대로 뽑힌다

그리고 마지막에 그냥 AB값 곱해준거 하면 끝

 

25083

print('         ,r\'\"7\nr`-_   ,\'  ,/\n \\. \". L_r\'\n   `~\\/\n      |\n      |')

10171과 동일

728x90