#9997 미니멀리즘 시계

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

  • 시간 = 각도 / 30
  • 분 = int(각도%30) * 2

 

T=int(input())
for tc in range(1,T+1):
    angle=int(input())
    hour =int(angle/30)
    minut = int(angle%30)*2
    print(f'#{tc} {hour} {minut}')

 

 

 

#10032 과자분배

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

  • N개의 과자 % K 명 == 0 이면 공평하게 나뉨
  • N개의 과자 % K 명 > 0 이면, N을 K개 만큼 공평하게 나누다 남은 개수 = (가장 많이 받은 사람 - 가장 적게 받은 사람)의 최솟값

 

T=int(input())
for tc in range(1,T+1):
    N,K=map(int,input().split())
    
    print(f'#{tc}', end=' ')
    if N % K == 0:
        print(0)
    else:
        print(N%K)

 

 

#10059 유효기간

 

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

  • 슬라이싱 이용
  • 1<=MM<=12
  • YY == 00 일 경우 포함 

 

T= int(input())
for tc in range(1,T+1):
    num=input()
    
    print(f'#{tc}',end=' ')
    if (int(num[0:2])>= 1 and int(num[0:2]) <=12) and ( int(num[2:]) >=1 and int(num[2:]) <=12):
        print('AMBIGUOUS')
    elif (int(num[0:2]) >= 1 and int(num[0:2]) <=12) and (int(num[2:]) > 12) or num[2:] == '00':
        print('MMYY')
    elif (int(num[0:2])> 12) or num[0:2] =='00' and (int(num[2:]) >= 1 and int(num[2:]) <=12):
        print("YYMM")
    elif (int(num[0:2])) >12  and (int(num[2:])>12):
        print("NA")

 

 

 

#10505 소득 불균형

 

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

  • 평균 값보다 작으면 cnt +1
  • N번 길이보다 num길이가 크면 break

 

T=int(input())
for tc in range(1,T+1):
    N=int(input())
    num = list(map(int,input().split()))
    cnt=0

    if len(num) > N:
        break

    else:
        for n in num:
            if n <= int(sum(num)/N):
                cnt+=1
            else:
                continue
    print(f'#{tc} {cnt}')

 

 

 

 

#10200 구독자 전쟁

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

  • A,B 중 작은 수 = 둘 다 구독할 경우의 최댓값
  • 최솟값 ) A+B >N 경우, (A+B)-N
  • 최솟값 ) A+B <N 경우, 0

 

 

T = int(input())
for tc in range(1,T+1):
    n,a,b=map(int,input().split())

    max_sub=0
    min_sub=0
    if a>n and b>n:
        break
    else:
        if a > b:
            max_sub =b
        else :
            max_sub=a

        if a+b>n:
            min_sub=(a+b)-n
        else:
            min_sub=0
    print(f'#{tc} {max_sub} {min_sub}')

 

 

 

📮개인 공부를 위한 공간으로 틀린 부분이 있을 수도 있습니다.📮

문제점 및 수정 사항이 있을 시, 언제든지 댓글로 피드백 주시기 바랍니다.

'algorithm > swea' 카테고리의 다른 글

[swea/python] #10570 제곱 팰린드롬 수  (0) 2022.04.26

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&problemLevel=2&problemLevel=3&contestProbId=AXO72aaqPrcDFAXS&categoryId=AXO72aaqPrcDFAXS&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=3

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

  • 1. 숫자의 맨 앞과 맨 뒤가 같은 수인지
  • 2. 제곱근 값이 int 형인지 (정수형)

 

import math 
t=int(input())
for tc in range(t):
    a,b = map(int,input().split())
    cnt = 0
    for i in range(a,b+1):
        rute = math.sqrt(i) //  i**(1/2)과 동일
        if rute ==int(rute):
            i = str(i)
            rute = str(int(rute))
            if i == i[::-1] and rute == rute[::-1]:
                cnt+=1
    print(f'#{tc+1} {cnt}')

 

 

📮개인 공부를 위한 공간으로 틀린 부분이 있을 수도 있습니다.📮

문제점 및 수정 사항이 있을 시, 언제든지 댓글로 피드백 주시기 바랍니다.

'algorithm > swea' 카테고리의 다른 글

[swea/python] #9997 #10032 #10059 #10505 #10200  (0) 2022.04.27