본문 바로가기

python-algorithm1422

백준 28444 HI-ARC=? 링크 : https://www.acmicpc.net/problem/28444 28444번: HI-ARC=? 첫째 줄에 각 문자에 들어갈 값 $H, I, A, R, C$ ($0 \leq H,I,A,R,C \leq 100$, $H,I,A,R,C$는 정수) 가 공백을 사이에 두고 순서대로 주어진다. www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(nums): return nums[0] * nums[1] - nums[2] * nums[3] * nums[4] if __name__ == '__main__': nums = list(map(int, input().split())) print(sol(nums)) Colored by Color Scripter cs 사용된 알고리즘 : X 리스트로 입.. 2023. 9. 12.
백준 28701 세제곱의 합 링크 : https://www.acmicpc.net/problem/28701 28701번: 세제곱의 합 $a$의 제곱은 $a$를 두 번 곱한 수로, $a^2$으로 표현합니다. $a^2 = a \times a$입니다. 또한, $a$의 세제곱은 $a$를 세 번 곱한 수로, $a^3$으로 표현합니다. $a^3 = a \times a \times a$ 입니다. www.acmicpc.net 1 2 3 4 5 6 7 def sol(n): print(n*(n+1)//2) print((n*(n+1)//2)**2) print((n*(n+1)//2)**2) if __name__ == '__main__': n = int(input()) sol(n) cs 사용된 알고리즘 : X 알고리즘 보다 수학적 정의를 내리시는게 조금 더.. 2023. 9. 12.
백준 2393 Rook 링크 : https://www.acmicpc.net/problem/2393 2393번: Rook The rook art, exactly as shown below, with no extra blank spaces. In particular, a line must not end with a blank space. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def sol(): print(" ___ ___ ___") print(" | |__| |__| |") print(" | |") print(" \\_________/") print(" \\_______/") print(" | |") print(" | |") print(" | |") print(" .. 2023. 9. 12.
백준 28235 코드마스터 2023 링크 : https://www.acmicpc.net/problem/28235 28235번: 코드마스터 2023 송도고등학교에서 주최하는 첫 중고등학생 대상 알고리즘 대회, "코드마스터 2023"이 열렸다! 이 대회가 중고등학생들에게 인기 있는 알고리즘 대회이자 오프라인 이벤트로서 자리매김할 수 있 www.acmicpc.net 사용된 알고리즘 : X 간단한 입력 후 출력 입니다. 딕셔너리를 사용했습니다! 1 2 3 4 5 6 7 8 9 10 11 12 def sol(guho): guhos ={ 'SONGDO':'HIGHSCHOOL', 'CODE': 'MASTER', '2023': '0611', 'ALGORITHM': 'CONTEST' } return guhos[guho] if __name__ == '__m.. 2023. 9. 11.
leetcode 2798. Number of Employees Who Met the Target https://leetcode.com/problems/number-of-employees-who-met-the-target/description/ Number of Employees Who Met the Target - LeetCode Can you solve this real interview question? Number of Employees Who Met the Target - There are n employees in a company, numbered from 0 to n - 1. Each employee i has worked for hours[i] hours in the company. The company requires each employee to work for leetcode.c.. 2023. 8. 4.
leetcode 2744. Find Maximum Number of String Pairs https://leetcode.com/problems/find-maximum-number-of-string-pairs/description/ Find Maximum Number of String Pairs - LeetCode Can you solve this real interview question? Find Maximum Number of String Pairs - You are given a 0-indexed array words consisting of distinct strings. The string words[i] can be paired with the string words[j] if: * The string words[i] is equal to the rev leetcode.com 1 .. 2023. 7. 13.
leetcode 2769. Find the Maximum Achievable Number https://leetcode.com/problems/find-the-maximum-achievable-number/description/ - LeetCode Can you solve this real interview question? - You are given two integers, num and t. An integer x is called achievable if it can become equal to num after applying the following operation no more than t times: * Increase or decrease x by 1, and simultaneou leetcode.com 1 2 3 class Solution: def theMaximumAch.. 2023. 7. 13.
leetcode 2739. Total Distance Traveled https://leetcode.com/problems/total-distance-traveled/description/ Total Distance Traveled - LeetCode Can you solve this real interview question? Total Distance Traveled - A truck has two fuel tanks. You are given two integers, mainTank representing the fuel present in the main tank in liters and additionalTank representing the fuel present in the addition leetcode.com 1 2 3 4 5 6 7 8 9 10 11 12.. 2023. 7. 7.
leetcode 2651. Calculate Delayed Arrival Time https://leetcode.com/problems/calculate-delayed-arrival-time/description/ Calculate Delayed Arrival Time - LeetCode Can you solve this real interview question? Calculate Delayed Arrival Time - You are given a positive integer arrivalTime denoting the arrival time of a train in hours, and another positive integer delayedTime denoting the amount of delay in hours. Return leetcode.com 1 2 3 class S.. 2023. 7. 6.
leetcode 2544. Alternating Digit Sum https://leetcode.com/problems/alternating-digit-sum/description/ Alternating Digit Sum - LeetCode Can you solve this real interview question? Alternating Digit Sum - You are given a positive integer n. Each digit of n has a sign according to the following rules: * The most significant digit is assigned a positive sign. * Each other digit has an opposit leetcode.com 1 2 3 4 5 6 7 8 9 10 11 class .. 2023. 7. 3.
leetcode 2595. Number of Even and Odd Bits https://leetcode.com/problems/number-of-even-and-odd-bits/description/ Number of Even and Odd Bits - LeetCode Can you solve this real interview question? Number of Even and Odd Bits - You are given a positive integer n. Let even denote the number of even indices in the binary representation of n (0-indexed) with value 1. Let odd denote the number of odd indices in leetcode.com 1 2 3 4 5 6 7 8 9 .. 2023. 6. 27.
leetcode 2716. Minimize String Length https://leetcode.com/problems/minimize-string-length/description/ Minimize String Length - LeetCode Can you solve this real interview question? Minimize String Length - Given a 0-indexed string s, repeatedly perform the following operation any number of times: * Choose an index i in the string, and let c be the character in position i. Delete the closest leetcode.com 1 2 3 4 5 class Solution: de.. 2023. 6. 27.