본문 바로가기

백준1056

백준 25932 Find the Twins https://www.acmicpc.net/problem/25932 25932번: Find the Twins Print each input set. Then, on the next output line, print one of four messages (mack, zack, both, none), indicating how many of the twins are in the set. Leave a blank line after the output for each test case. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 if __name__ == '__main__': n = int(input()) for _ in range(n): answer = 'n.. 2022. 11. 16.
백준 11121 Communication Channels https://www.acmicpc.net/problem/11121 11121번: Communication Channels The first line of the input consists of a single number T, the number of transmissions. Then follow T lines with the input and the output of each transmission as binary strings, separated by a single space. 0 < T ≤ 100 All inputs and outputs has length l www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(origin,changed): for i in .. 2022. 11. 15.
백준 8718 Bałwanek https://www.acmicpc.net/problem/8718 8718번: Bałwanek W pierwszym wierszu wejścia znajdują się dwie liczby całkowite x, k (1 ≤ x ≤ 106, 1 ≤ k ≤ 105, k < x), oznaczające odpowiednio ilość litrów śniegu w parku oraz z ilu litrów śniegu zbudowana jest jedna z kul śnieżnych bałwana. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def sol(n,k): answer =[] n= n*1000 k= k*1000 answer = 0 answer_list = .. 2022. 11. 15.
백준 7595 Triangles https://www.acmicpc.net/problem/7595 7595번: Triangles Each line of input contains a single positive integer, n, 1 2022. 11. 15.
백준 16099 Larger Sport Facility https://www.acmicpc.net/problem/16099 16099번: Larger Sport Facility In a lot of places in the world, elite universities come in pairs and their students like to challenge each other every year. In England, Oxford and Cambridge are famous for The Boat Race, an annual rowing race that opposes them. In Switzerland, students f www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 if __name__ == '__main__': n=int(inp.. 2022. 11. 15.
백준 23235 The Fastest Sorting Algorithm In The World https://www.acmicpc.net/problem/23235 23235번: The Fastest Sorting Algorithm In The World It is common to compare sorting algorithms based on their asymptotic speeds. Some slower algorithms like selection sort take O(N2) time to sort N items, while comparison-based sorts like merge sort can go no faster than O(N log(N)) time, under reasonable a www.acmicpc.net 1 2 3 4 5 6 7 8 9 if __name__ == '__.. 2022. 11. 15.
백준 25311 UCPC에서 가장 쉬운 문제 번호는? https://www.acmicpc.net/problem/25311 25311번: UCPC에서 가장 쉬운 문제 번호는? 대회 참가자는 되도록 일찍 대회의 모든 문제를 한 번씩 읽어 보는 것이 권장됩니다. 이렇게 하면 대회의 전체적인 분위기를 느낄 수 있고, 종종 비교적 쉬운 문제를 빨리 발견해서 속도에서 우 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 import unittest def sol(y): return 'A' class SolTest(unittest.TestCase): def test_sol(self): self.assertEqual(sol(2018),'A') self.assertEqual(sol(2019), 'A') self.assertEqual(sol(.. 2022. 11. 15.
백준 12833 XORXORXOR https://www.acmicpc.net/problem/12833 12833번: XORXORXOR 세 수 A, B, C를 입력 받은 다음, ( ( ( ( A XOR B ) XOR B ) XOR B ) … ) XOR B 형태로 연산을 C회 했을 때의 결과값을 출력하는 프로그램을 작성하시오. www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(a,b,c): answer = a if c%2 == 1: answer = a^b return answer if __name__ == '__main__': a,b,c = map(int, input().split()) print(sol(a,b,c)) cs 단순 반복문으로 풀게되면 시간초과가 나올거에요 If you use just loop, You go.. 2022. 11. 14.
백준 15947 아기 석환 뚜루루 뚜루 https://www.acmicpc.net/problem/15947 15947번: 아기 석환 뚜루루 뚜루 첫 번째 줄에 석환이가 N번째로 부를 단어를 출력한다. 여기서 단어란 가사 중 공백으로 구분되는 연속된 알파벳 소문자열을 뜻한다. 단, 출력할 단어가 “tururu...ru”일 때, “ru”가 k(k ≥ 5)번 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def sol(n): n-=1 song ='baby sukhwan tururu turu very cute tururu turu in bed tururu turu baby sukhwan' song= list(song.split()) idx = n%14 repeat = n//14 if idx in [.. 2022. 11. 14.
백준 12791 Starman https://www.acmicpc.net/problem/12791 12791번: Starman 첫 번째 줄에 질의의 수 정수 Q(Q ≤ 100)가 주어진다. 이후 Q개의 줄에 질의 S, E(1 ≤ S ≤ E ≤ 2016)가 정수로 주어진다. www.acmicpc.net 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 32 33 34 35 36 37 38 39 40 41 42 def sol(album,s,e): cnt = 0 answer=[] for i in album: if i[0]>=s and i[0]e: break print(cnt) for i in answer: print(i[0],i[1]) if.. 2022. 11. 14.
백준 16171 나는 친구가 적다 (Small) https://www.acmicpc.net/problem/16171 16171번: 나는 친구가 적다 (Small) 첫 번째 줄에는 알파벳 소문자, 대문자, 숫자로 이루어진 문자열 S가 주어진다. (1 ≤ |S| ≤ 100) 두 번째 줄에는 성민이가 찾고자 하는 알파벳 소문자, 대문자로만 이루어진 키워드 문자열 K가 주 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(s, k): new_s='' for i in s: if i.isalpha(): new_s+=i if k in new_s: return 1 else: return 0 if __name__ == '__main__': s=input() k=input() print(sol(s, k)) cs isalph.. 2022. 11. 13.
백준 17202 핸드폰 번호 궁합 https://www.acmicpc.net/problem/17202 17202번: 핸드폰 번호 궁합 어린시절 다들 한 번씩은 이름으로 궁합을 본 적이 있을 것이다. 이것과 비슷한 방식으로 중앙대학교에는 핸드폰 번호 궁합을 보는 것이 유행이라고 한다. 핸드폰 번호 궁합을 보기 위해서는 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def sol(gunghap): new_gunghap='' for i in range(len(gunghap)-1): new_gunghap+= str((int(gunghap[i])+int(gunghap[i+1]))%10) if len(new_gunghap)>2: return sol(new_gunghap) return new_.. 2022. 11. 13.