본문 바로가기

백준1064

백준 32929 UOS 문자열 https://www.acmicpc.net/problem/32929 1234567891011121314def sol(n):    n -= 1    if n % 3 == 0:        return "U"    elif n % 3 == 1:        return "O"    elif n % 3 == 2:        return "S"  if __name__ == '__main__':    n = int(input())    print(sol(n)) cs넘나 쉬운것.. 2024. 12. 18.
백준 27058 Message Decowding https://www.acmicpc.net/problem/27058 12345678910111213141516171819202122232425def sol(encryption, message ):    answer = ""    for char in message:        is_upper = False        if char.isupper() :            is_upper = True        if char == " ":            answer += " "            continue        decoded_char = encryption[ord(char.lower()) - 97]         if is_upper:            answer += deco.. 2024. 12. 16.
백준 4775 Spelling Be https://www.acmicpc.net/problem/4775 1234567891011121314151617181920212223242526if __name__ == '__main__':    num_word = int(input())     word_dict = {}    cnt = 1    #word_dict = [input() for i in range(n)]    for i in range(num_word):        word_dict[input()] = 1    n = int(input())    for i in range(1, n+1):        not_exist = []        while True:            s = input()             if s == .. 2024. 12. 3.
백준 18698 The Walking Adam https://www.acmicpc.net/problem/18698 1234567891011def sol(steps):    first_fall_down = steps.split("D")    return len(first_fall_down[0])   if __name__ == '__main__':    n = int(input())    for i in range(n):        steps = input()        print(sol(steps))cs사실 이 문제는 U를 선형탐색하면서 조건에 따라 카운팅 해도 되지만그럼 길어지므로 차라리 D를 기준으로 쪼개는게 더 빠를것 같아요 2024. 12. 3.
백준 32498 Call for Problems https://www.acmicpc.net/problem/32498 1234if __name__ == '__main__':    n = int(input())    nums = [1 for num in range(n) if int(input()) % 2 == 1]    print(len(nums))Colored by Color Scriptercs 2024. 11. 27.
백준 32384 사랑은 고려대입니다 https://www.acmicpc.net/problem/32384 12345678910def sol(n):    answer = ["LoveisKoreaUniversity" for i in range(n)]    print(*answer)   if __name__ == '__main__':    n = int(input())    sol(n) Colored by Color Scriptercs조건문이나 다른방식으로 출력해도 되는데가장 pythonic 하게 풀려면 list comprehension 과 unpacking 해서 출력하면 깔끔하게 해결가능 2024. 11. 27.
백준 32260 A + B https://www.acmicpc.net/problem/32260 123456#include "aplusb.h" int sum(int A, int B) {  return A + B ;} cs 2024. 10. 27.
백준 32154 SUAPC 2024 Winter https://www.acmicpc.net/problem/32154 1234567891011121314151617181920def sol(rank_num):    answer = {1: [11, ["A", "B", "C", "D", "E", "F", "G", "H", "J", "L", "M"]]        , 2: [9, ["A", "C", "E", "F", "G", "H", "I", "L", "M"]]        , 3: [9, ["A", "C", "E", "F", "G", "H", "I", "L", "M"]]        , 4: [9, ["A", "B", "C", "E", "F", "G", "H", "L", "M"]]        , 5: [8, ["A", "C", "E", "F", "G", ".. 2024. 10. 27.
백준 31994 강당 대관 https://www.acmicpc.net/problem/31994 123456789def sol(seminar_list):    seminar_list.sort(key=lambda x: -int(x[1]))    return seminar_list[0][0]  if __name__ == '__main__':    seminar_list = [input().split() for i in range(7)]    print(sol(seminar_list)) Colored by Color Scriptercs 2024. 7. 15.
백준 32025 체육은 수학과목 입니다 https://www.acmicpc.net/problem/32025 12345678910def sol(h, w):    return min(h, w) * 100 // 2  if __name__ == '__main__':    h = int(input())    w = int(input())     print(sol(h, w)) Colored by Color Scriptercs 2024. 7. 15.
백준 30979 유치원생 파댕이 돌보기 https://www.acmicpc.net/problem/30979 12345678910111213def sol(t, candys):    if t > candys:        return "Padaeng_i Cry"    else:        return "Padaeng_i Happy"  if __name__ == '__main__':    t = int(input())    n = int(input())    candys = sum(list(map(int, input().split())))    print(sol(t, candys)) Colored by Color Scriptercs 2024. 6. 19.
백준 27736 찬반투표 https://www.acmicpc.net/problem/27736 27736번: 찬반투표 투표가 통과되었으면 APPROVED, 통과되지 않았으면 REJECTED, 무효 처리되었으면 INVALID를 출력한다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 from math import ceil def sol(nums): if nums.count(0) >= ceil(len(nums)/2): return 'INVALID' elif sum(nums) 재학생절반 2.5명인데 3명으로 간주해야할 듯 싶어요 2024. 4. 21.