본문 바로가기

python-algorithm1422

백준 25756 방어율 무시 계산하기 https://www.acmicpc.net/problem/25756 25756번: 방어율 무시 계산하기 메이플스토리에는 방어율 무시라는 수치가 있다. 특정 보스를 잡기 위해서는 특정 방어율 무시 수치가 되어야 데미지가 정확히 들어가는 시스템으로 이루어져 있다. 물약 아이템을 사용하여 방 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(nums): n = len(nums) current_defend = 0 for i in range(n): defend = 100 - (100-current_defend)*(100-nums[i])/100 print(defend) current_defend = defend if __name__ == '__main__': len_n.. 2022. 12. 22.
백준 24072 帰省 (Homecoming) https://www.acmicpc.net/problem/24072 24072번: 帰省 (Homecoming) ビーバーのビ太郎は帰省することにした.今日から A 日後の午前に実家に着き,今日から B 日後の午前に実家を去る.それを聞きつけたビーバーのビバ子は,今日から C 日後の午後にビ www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a, b, c): if a 2022. 12. 22.
백준 26711 A+B https://www.acmicpc.net/problem/26711 26711번: A+B Mamy dla was zadanie stare jak świat, ale w nieco odświeżonej wersji. Polega ono na dodaniu do siebie dwóch liczb, które tym razem mogą być dość duże. Gdyby tylko na Potyczkach Algorytmicznych było jakieś narzędzie, które pomaga radzić sobie www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a, b): answer = a + b return answer if __name__ == '__main__': a.. 2022. 12. 22.
백준 20833 Kuber https://www.acmicpc.net/problem/20833 20833번: Kuber Nadja klistrar ihop små träkuber med sidlängd 1 till större kompakta kuber. Hon har nu bestämt sig för att hon vill ha en kub av varje sidlängd från 1 till N. Hur många småkuber behöver Nadja? www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(n): answer = 0 for i in range(1,n+1): answer+=i**3 return answer if __name__ == '__main__': n = int(input()) prin.. 2022. 12. 21.
백준 21631 Checkers https://www.acmicpc.net/problem/21631 21631번: Checkers The only line of input contains two integers $a$ and $b$ --- the number of white and black pieces, respectively ($0 \le a, b \le 10^{18}$). www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(a, b): if a>=b: return b else: return a+1 if __name__ == '__main__': a, b = map(int, input().split()) print(sol(a, b)) Colored by Color Scripter cs 2022. 12. 21.
백준 24075 計算 (Calculation) https://www.acmicpc.net/problem/24075 24075번: 計算 (Calculation) 2 つの整数 A, B が与えられる.A+B, A-B の中で最大の値と最小の値を順に出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 def sol(a, b): print(max(a + b, a - b)) print(min(a+b,a-b)) if __name__ == '__main__': a, b = map(int, input().split()) sol(a, b) cs 2022. 12. 21.
백준 21354 Äpplen och päron https://www.acmicpc.net/problem/21354 21354번: Äpplen och päron En rad med två heltal $A,P$ ($0 \le A,P \le 1000)$, antalet äpplen Axel har lyckats sälja, och antalet päron Petra har lyckats sälja. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(a, p): if 7*a>13*p: return 'Axel' elif 7*a 2022. 12. 21.
백준 21633 Bank Transfer https://www.acmicpc.net/problem/21633 21633번: Bank Transfer Tanya has an account in "Redgotts" bank. The bank has the commission to transfer money to "Bluegotts" bank that her friend Vanya has the account in. Tanya has read her bank rules and learned the following: The commission for the bank transfer is $25$ tugri www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(n): answer = 25 + n*0.01 if answe.. 2022. 12. 21.
백준 13580 Andando no tempo https://www.acmicpc.net/problem/13580 13580번: Andando no tempo Imagine que você tenha uma máquina do tempo que pode ser usada no máximo três vezes, e a cada uso da máquina você pode escolher voltar para o passado ou ir para o futuro. A máquina possui três créditos fixos; cada crédito representa uma certa qua www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(nums): nums.sort() if max(nums) == sum(n.. 2022. 12. 21.
백준 21335 Another Eruption https://www.acmicpc.net/problem/21335 21335번: Another Eruption A volcano has recently erupted in Geldingadalur, Iceland. Fortunately this eruption is relatively small, and---unlike the infamous Eyjafjallajökull eruption---is not expected to cause delayed international flights or global outrage. There is some concern www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a): pi = 3.141592 r = (a/pi)**(1/2) an.. 2022. 12. 21.
백준 20215 Cutting Corners https://www.acmicpc.net/problem/20215 20215번: Cutting Corners A large coffee spill in the warehouse of the Busy Association of Papercutters on Caffeine has stained the corners of all paper in storage. In order to not waste money, it was decided that these dirty corners should be cut off of all pieces of paper. A few www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(w, h): diagonal = (w**2+h**2)**(1/2) a.. 2022. 12. 21.
백준 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.