본문 바로가기

백준1054

백준 18409 母音を数える (Counting Vowels) https://www.acmicpc.net/problem/18409 18409번: 母音を数える (Counting Vowels) 長さ N の英小文字からなる文字列 S が与えられる.S のうち母音字の個数,つまり a,i,u,e,o の個数の総和を求めよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(s): answer = 0 vowels = ['a','e','i','o','u'] for vowel in vowels: answer+=s.count(vowel) return answer if __name__ == '__main__': len_s = int(input()) s = input() print(sol(s)) cs 2022. 12. 21.
백준 20352 Circus https://www.acmicpc.net/problem/20352 20352번: Circus In the modern world, the spotlight has shifted entirely from live shows to televised recordings. Well, not entirely... One small troupe of indomitable entertainers still holds out and puts on regular circus performances. The shows are extremely popular. www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(n): pi = 3.141592 r = (n/pi)**(1/2) return 2*pi*r i.. 2022. 12. 20.
백준 15128 Congruent Numbers https://www.acmicpc.net/problem/15128 15128번: Congruent Numbers Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each test case will consist of a single line with four integers p1, q1, p2 and q2 (1 ≤ p1,q1,p2,q2 ≤ 100,000) where p1/q1 and p2/q2 are www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(p1, q1, p2, q2): area = p1*p2/q1/q2/.. 2022. 12. 20.
백준 24860 Counting Antibodies https://www.acmicpc.net/problem/24860 24860번: Counting Antibodies Immunoglobulins also known as antibodies are protein molecules. Antibodies play one of the key roles in the immune reaction --- they detect harmful foreign agents --- bacteria or viruses --- and help to eliminate them. Every foreign molecule binds with uni www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(vk, jk, vl,jl,vh,dh,j): return (v.. 2022. 12. 20.
백준 22015 金平糖 (Konpeito) https://www.acmicpc.net/problem/22015 22015번: 金平糖 (Konpeito) JOI 高校の生徒である葵と凛は,教師の理恵先生と一緒に 3 人で金平糖を同じ数だけ食べることにした. いま,葵は A 粒,凛は B 粒,理恵先生は C 粒の金平糖を食べた.3 人が食べた金 www.acmicpc.net 1 2 3 4 5 6 def sol(nums): return max(nums)*len(nums) -sum(nums) if __name__ == '__main__': nums = list(map(int, input().split())) print(sol(nums)) cs 2022. 12. 20.
백준 20673 Covid-19 https://www.acmicpc.net/problem/20673 20673번: Covid-19 The input consists of two lines. The first line contains an integer p (0 ⩽ p ⩽ 1000), showing the average number of new cases per day in every one million population in Hana’s city over the past two weeks. The second line contains an integer q (0 ⩽ www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(p ,q): if p 2022. 12. 20.
백준 21591 Laptop Sticker https://www.acmicpc.net/problem/21591 21591번: Laptop Sticker The single line of input contains four integers $w_c$, $h_c$, $w_s$ and $h_s$ ($1 \le w_c, h_c, w_s, h_s \le 1,000$), where $w_c$ is the width of your new laptop computer, $h_c$ is the height of your new laptop computer, $w_s$ is the width of the laptop s www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(wc, hc, ws, hs): answer = 0 if wc-ws.. 2022. 12. 20.
백준 15232 Rectangles https://www.acmicpc.net/problem/15232 15232번: Rectangles Read two integer numbers R and C from the standard input and then print R lines with C asterisks (*) each. Example (R=3, C=5): ***** ***** ***** Example (R=2, C=10): ********** ********** www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(r,c): for _ in range(r): print('*'*(c)) if __name__ == '__main__': r = int(input()) c = int(input()) sol(r, c) cs 2022. 12. 20.
백준 26545 Mathematics https://www.acmicpc.net/problem/26545 26545번: Mathematics A mathematician has stolen your calculator! Luckily, you know how to code and can write a program that adds together numbers. Write a program that adds together a list of integers. www.acmicpc.net 1 2 3 4 5 6 if __name__ == '__main__': n = int(input()) ans = 0 for _ in range(n): ans += int(input()) print(ans) cs 2022. 12. 19.
백준 26574 Copier https://www.acmicpc.net/problem/26574 26574번: Copier Your copier broke down last week, and you need to copy a list of numbers for a class project due tomorrow! Luckily, you can use your computer to copy the numbers for you. Given a list of numbers, each on their own line, print out the number, a space, and t www.acmicpc.net 1 2 3 4 5 6 7 def sol(num): print(num,num) if __name__ == '__main__': n .. 2022. 12. 19.
백준 10189 Hook https://www.acmicpc.net/problem/10189 10189번: Hook Print out the word Hook as shown below. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(): print('# # #### #### # #') print('#### # # # # # #') print('#### # # # # # #') print('# # #### #### # #') if __name__ == '__main__': sol() cs 2022. 12. 19.
백준 6840 Who is in the middle? https://www.acmicpc.net/problem/6840 6840번: Who is in the middle? In the story Goldilocks and the Three Bears, each bear had a bowl of porridge to eat while sitting at his/her favourite chair. What the story didn’t tell us is that Goldilocks moved the bowls around on the table, so the bowls were not at the right seats www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(bears): return sum(bears) - (m.. 2022. 12. 17.