본문 바로가기

python-algorithm1413

백준 27294 몇개고? https://www.acmicpc.net/problem/27294 27294번: 몇개고? 첫 번째 줄에 시간을 의미하는 정수 $T$ ($0 \le T \le 23$)와 술의 유무를 의미하는 정수 $S$ ($0 \le S \le 1$)가 공백으로 구분되어 주어진다. $T$가 $11$이하이면 아침 시간, $12$이상 $16$ 이하이면 점심 시 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(t, s): if t>=12 and t 2023. 1. 31.
백준 27328 三方比較 (Three-Way Comparison) https://www.acmicpc.net/problem/27328 27328번: 三方比較 (Three-Way Comparison) 2 つの整数 A, B が与えられる. A と B の大小を比較し,A < B ならば -1 を,A = B ならば 0 を,A > B ならば 1 を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def sol(a, b): if a>b: return 1 elif a == b: return 0 else: return -1 if __name__ == '__main__': a = int(input()) b = int(input()) print(sol(a, b)) cs 2023. 1. 31.
백준 27327 時間 (Hour) https://www.acmicpc.net/problem/27327 27327번: 時間 (Hour) X 日は何時間か,単位 (時間) を省いて出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(n): answer = n*24 return answer if __name__ == '__main__': n = int(input()) print(sol(n)) cs 2023. 1. 31.
백준 27331 2 桁の整数 (Two-digit Integer) https://www.acmicpc.net/problem/27331 27331번: 2 桁の整数 (Two-digit Integer) 2 つの数字 A, B が与えられる. 十の位が A であり,一の位が B である 2 桁の正の整数を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a, b): return a+b if __name__ == '__main__': a = str(input()) b = str(input()) print(sol(a, b)) cs 2023. 1. 31.
백준 27324 ゾロ目 (Same Numbers) https://www.acmicpc.net/problem/27324 27324번: ゾロ目 (Same Numbers) N の十の位の数字と一の位の数字が同じである場合は 1 を,そうでない場合は 0 を出力せよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(n): if n%10 == n//10 : return 1 else: return 0 if __name__ == '__main__': n = int(input()) print(sol(n)) cs 2023. 1. 31.
백준 27323 長方形 (Rectangle) https://www.acmicpc.net/problem/27323 27323번: 長方形 (Rectangle) 整数 A, B が与えられる.縦の辺の長さが A cm,横の辺の長さが B cm である下図のような長方形の面積は何 cm2 か求めよ. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(a, b): answer = a * b return answer if __name__ == '__main__': a = int(input()) b = int(input()) print(sol(a, b)) cs 2023. 1. 31.
leetcode 1137. N-th Tribonacci Number https://leetcode.com/problems/n-th-tribonacci-number/description/ N-th Tribonacci Number - LeetCode N-th Tribonacci Number - The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given n, return the value of Tn. Example 1: Input: n = 4 Output: 4 Explanation: T_3 = 0 + 1 + 1 = 2 T_4 = 1 + 1 leetcode.com 1 2 3 4 5 6 7 8 9 10 11 class Solu.. 2023. 1. 30.
leetcode 196. Delete Duplicate Emails https://leetcode.com/problems/delete-duplicate-emails/description/ Delete Duplicate Emails - LeetCode Delete Duplicate Emails - Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | email | varchar | +-------------+---------+ id is the primary key column for this table. Each row of this table contains an em leetcode.com 1 2 3 4 5 6 7 # Please wri.. 2023. 1. 29.
leetcode 2433. Find The Original Array of Prefix Xor https://leetcode.com/problems/find-the-original-array-of-prefix-xor/description/ Find The Original Array of Prefix Xor - LeetCode Find The Original Array of Prefix Xor - You are given an integer array pref of size n. Find and return the array arr of size n that satisfies: * pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i]. Note that ^ denotes the bitwise-xor operation. It can be proven that leetcode.com.. 2023. 1. 27.
leetcode 2545. Sort the Students by Their Kth Score https://leetcode.com/problems/sort-the-students-by-their-kth-score/description/ Sort the Students by Their Kth Score - LeetCode Sort the Students by Their Kth Score - There is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row represents one student and score[i][j] denotes the score the ith student got in the jth exam. The matr leetcode.com .. 2023. 1. 27.
leetcode 2396. Strictly Palindromic Number https://leetcode.com/problems/strictly-palindromic-number/description/ Strictly Palindromic Number - LeetCode Strictly Palindromic Number - An integer n is strictly palindromic if, for every base b between 2 and n - 2 (inclusive), the string representation of the integer n in base b is palindromic. Given an integer n, return true if n is strictly palindromic and f leetcode.com 1 2 3 4 5 6 7 8 9 .. 2023. 1. 27.
leetcode 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/description/ Partitioning Into Minimum Number Of Deci-Binary Numbers - LeetCode Partitioning Into Minimum Number Of Deci-Binary Numbers - A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not.. 2023. 1. 26.