본문 바로가기

python-algorithm1422

백준 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.
codeforces 50A - Domino piling 50A - Domino piling Problem - 50A - Codeforces codeforces.com 1 2 3 4 5 6 7 8 9 def sol(m, n): answer = (m * n) // 2 return answer if __name__ == '__main__': m, n = map(int, input().split()) print(sol(m, n)) Colored by Color Scripter cs 2023. 1. 25.
codeforces 1772A - A+B? https://codeforces.com/problemset/problem/1772/A Problem - 1772A - Codeforces codeforces.com 1 2 3 4 5 6 if __name__ == '__main__': t = int(input()) for _ in range(t): s = input() print(eval(s)) cs 2023. 1. 25.
codeforces 1760A - Medium Number https://codeforces.com/problemset/problem/1760/A Problem - 1760A - Codeforces codeforces.com 1 2 3 4 5 6 7 8 9 10 11 12 13 14 from statistics import median def sol(nums): answer = median(nums) return answer if __name__ == '__main__': n = int(input()) for _ in range(n): nums = list(map(int, input().split())) print(sol(nums)) Colored by Color Scripter cs 2023. 1. 25.