Programming/JUNGOL : 정보올림피아드&알고리즘

[JUNGOL LCoder_Python 함수2]:981~992

토토모에요 2022. 2. 1. 21:10
728x90
반응형

JUNGOL 정보올림피아드&알고리즘에서 학습용으로 문제를 가져왔습니다. 문제가 될 시 수정, 삭제하겠습니다.

http://www.jungol.co.kr/

981

def function():
    n=int(input())
    m=list(map(int,input().split()))
    m.sort(reverse=True)
    print(*m)

function()

982

def function(arr):
    day=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
    month=[1,2,3,4,5,6,7,8,9,10,11,12]
    if m[1] in day and m[0] in month:
        if m[1]==2 and (m[0]==30 or m[0]==31):
            print("BAD!")
        elif m[1]==4 and m[0]==31:
            print("BAD!")
        elif m[1] == 6 and m[0]==31:
            print("BAD!")
        elif m[1] == 9 and m[0]==31:
            print("BAD!")
        elif m[1] == 11 and m[0]==31:
            print("BAD!")
        else:
            print("OK!")
    else:
        print("BAD!")

m=list(map(int,input().split()))
function(m)

983 Accepted(95)

def function(m):
    if abs(m[0])>abs(m[1]):
        print(m[0])
    elif abs(m[1])>abs(m[0]):
        print(m[1])
    else:
        print(m[1])

def function_two(n):
    if abs(n[0])>abs(n[1]):
        print(n[1])
    elif abs(n[1])>abs(n[0]):
        print(n[0])
    else:
        print(n[0])

m=list(map(int,input().split()))
n=list(map(float,input().split()))
function(m)
function_two(n)

984

def function(a):
    print("%.2f"%((a/3.14)**(1/2)))


a=int(input())
function(a)

985

986

def bubbleSort_DESC(arr):

    for i in range(len(arr)-1):
        for j in range(0,len(arr)-1-i):
            if arr[j+1]>arr[j]:
                arr[j+1], arr[j]=arr[j],arr[j+1]
        print(*arr)

a=list(map(int,input().split()))
bubbleSort_DESC(a)

987

def function(arr):
    arr.sort(reverse=True)
    print(*arr)

n=int(input())
m=list(map(int,input().split()))
function(m)

988

def function(arr):
    if arr[0]<arr[1]:
        arr[0]=int(arr[0]**(1/2))
        arr[1]=int(arr[1]**(1/2))
        lst=list(range(arr[0],arr[1]))
        print(len(lst))
    elif arr[0]>arr[1]:
        arr[0] = int(arr[0] ** (1 / 2))
        arr[1] = int(arr[1] ** (1 / 2))
        lst = list(range(arr[1], arr[0]))
        print(len(lst))


m=list(map(float,input().split()))
function(m)

989

def function(arr):
    total=(abs(m[0])+abs(m[1])+abs(m[2])+abs(m[3])+abs(m[4]))
    print(total)


m=list(map(int,input().split()))
function(m)

990

def function(a):
    print(2**a)


n=int(input())
function(n)

991

def function(arr):
    total=sum(arr)
    avg=total/3
    total_t=round(arr[0])+round(arr[1])+round(arr[2])
    avg_t=total_t/3
    print(round(avg))
    print(round(avg_t))
m=list(map(float,input().split()))
function(m)

992

def function(arr):
    for i in range(0,3):
        for j in range(0,len(arr)-1):
            if arr[j]>arr[j+1]:
                arr[j],arr[j+1]=arr[j+1],arr[j]
            elif arr[j]<arr[j+1]:
                pass
    print(*arr)

m=list(map(int,input().split()))
function(m)
반응형