www.acmicpc.net/problem/2920

 

2920번: 음계

다장조는 c d e f g a b C, 총 8개 음으로 이루어져있다. 이 문제에서 8개 음은 다음과 같이 숫자로 바꾸어 표현한다. c는 1로, d는 2로, ..., C를 8로 바꾼다. 1부터 8까지 차례대로 연주한다면 ascending, 8

www.acmicpc.net

num=list(map(intinput().split()))

a=[1,2,3,4,5,6,7,8]

b=[8,7,6,5,4,3,2,1]

for i in range(8):

    for j in range(1,8):

        if num==a:

            strr='ascending'

        elif num==b: 

            strr='descending'

        else: strr='mixed'

print(strr)

www.acmicpc.net/problem/2908

 

2908번: 상수

상근이의 동생 상수는 수학을 정말 못한다. 상수는 숫자를 읽는데 문제가 있다. 이렇게 수학을 못하는 상수를 위해서 상근이는 수의 크기를 비교하는 문제를 내주었다. 상근이는 세 자리 수 두

www.acmicpc.net

a,b=input().split()
ass=int(str(a)[::-1])
bss=int(str(b)[::-1])
if ass>bss: print(ass)
else: print(bss)

www.acmicpc.net/problem/2884

 

2884번: 알람 시계

상근이는 매일 아침 알람을 듣고 일어난다. 알람을 듣고 바로 일어나면 다행이겠지만, 항상 조금만 더 자려는 마음 때문에 매일 학교를 지각하고 있다. 상근이는 모든 방법을 동원해보았지만,

www.acmicpc.net

h,m=map(int, input().split())
0<=h<=23
0<=m<=59

if(0<h and m<45): print(h-1, m-45+60)
elif(0<h and m>=45): print(h, m-45)
elif(h==0 and m>45): print(h, m-45)
elif(h==0 and m<45): print((h-1)+24, m-45+60)
else: print(h, m-45)

www.acmicpc.net/problem/2753

 

2753번: 윤년

연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서

www.acmicpc.net

a=int(input())

1<=a and a<=4000

if a%4==0 and (a%400==0 or not(a%100==0)):print("1")

else:print("0")

www.acmicpc.net/problem/2742

 

2742번: 기찍 N

자연수 N이 주어졌을 때, N부터 1까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.

www.acmicpc.net

import sys

num=int(input())

for i in range(num,0,-1):

    print(i)

www.acmicpc.net/problem/2741

 

2741번: N 찍기

자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.

www.acmicpc.net

import sys

num=int(input())

for i in range(1,num+1):

    print(i)

www.acmicpc.net/problem/2739

 

2739번: 구구단

N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다.

www.acmicpc.net

n=int(input())

1<=n<9

 

for i in range(1,10):

    print( n,"*",i, "=", n*i)

www.acmicpc.net/problem/2675

 

2675번: 문자열 반복

문자열 S를 입력받은 후에, 각 문자를 R번 반복해 새 문자열 P를 만든 후 출력하는 프로그램을 작성하시오. 즉, 첫 번째 문자를 R번 반복하고, 두 번째 문자를 R번 반복하는 식으로 P를 만들면 된다

www.acmicpc.net

 

T=int(input()) #테스트케이스개수

new=[]

newstr=[]

for k in range(T):

    r, s = input().split()

    r=int(r)

    s=str(s)

    for j in range(len(s)):

        print(r*s[j],end='')

    print('')

+ Recent posts