본문 바로가기

백준1054

백준 16861 Harshad Numbers https://www.acmicpc.net/problem/16861 16861번: Harshad Numbers We’re all familiar with harshad numbers. For this problem, you will ... what’s that? You aren’t familiar with harshad numbers? They’re also known as Niven numbers – does that ring a bell?? Anything??? Well, it’s a simple enough concept. A harsh www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 def cal(n): answer = .. 2023. 1. 3.
백준 23343 JavaScript https://www.acmicpc.net/problem/23343 23343번: JavaScript Print the result of the minus operation (x - y) on one Line. If the result is an integer, please print it without the decimal point. If the result is not a number, please print NaN. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(x, y): if x.isdigit() and y.isdigit(): return int(x)-int(y) else: return 'NaN' if __name__ == '__main__': x, y = m.. 2023. 1. 3.
백준 24267 알고리즘 수업 - 알고리즘의 수행 시간 6 https://www.acmicpc.net/problem/24267 24267번: 알고리즘 수업 - 알고리즘의 수행 시간 6 오늘도 서준이는 알고리즘의 수행시간 수업 조교를 하고 있다. 아빠가 수업한 내용을 학생들이 잘 이해했는지 문제를 통해서 확인해보자. 입력의 크기 n이 주어지면 MenOfPassion 알고리즘 수행 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 from math import factorial if __name__ == '__main__': cnt = 0 n = int(input()) if n>=3: print(int(factorial(n)/(factorial(n-3)*factorial(3)))) else: print(0) print(3) Colored by .. 2023. 1. 3.
백준 11328 Strfry https://www.acmicpc.net/problem/11328 11328번: Strfry C 언어 프로그래밍에서 문자열(string)은 native한 자료형이 아니다. 사실, 문자열은 그저, 문자열의 끝을 표시하기 위한 말단의 NULL이 사용된, 문자들로 이루어진 문자열일 뿐이다. 하지만 프로그래 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(s1,s2): s1, s2 =sorted(s1), sorted(s2) if s1 == s2 : return 'Possible' else: return 'Impossible' if __name__ == '__main__': n = int(input()) for _ in range(n): s1, s2 = map(s.. 2023. 1. 2.
백준 3512 Flat https://www.acmicpc.net/problem/3512 3512번: Flat You are one of the developers of software for a real estate agency. One of the functions you are to implement is calculating different kinds of statistics for flats the agency is selling. Each flat consists of different types of rooms: bedroom, bathroom, k www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 if __name__ == '__main__': n, c = .. 2022. 12. 31.
백준 26264 빅데이터? 정보보호! https://www.acmicpc.net/problem/26264 cnt_bigdata: return 'security!' elif cnt_security 2022. 12. 30.
백준 26004 HI-ARC https://www.acmicpc.net/problem/26004 26004번: HI-ARC 첫째 줄에 문자열 $S$의 길이 정수 $N$이 주어진다. ($1 \leq N \leq 100\,000$) 둘째 줄에 문자열 $S$가 주어진다. 문자열 $S$의 모든 문자는 영어 대문자이다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(s): h,i,a,r,c = s.count('H'),s.count('I'),s.count('A'),s.count('R'),s.count('C') answer = min(h,i,a,r,c) return answer if __name__ == '__main__': n = int(input()) s = input() print(sol(s)) Color.. 2022. 12. 28.
백준 10698 Ahmed Aly https://www.acmicpc.net/problem/10698 10698번: Ahmed Aly Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by T lines, each test case is a single line containing an equation in the following format www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def sol(s): left, right = s.split('=') if .. 2022. 12. 28.
백준 16428 A/B - 3 https://www.acmicpc.net/problem/16428 16428번: A/B - 3 첫째 줄에 A와 B가 주어진다. (-1010000 ≤ A, B ≤ 1010000, B ≠ 0) www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(a, b): if b 2022. 12. 28.
백준 4806 줄 세기 https://www.acmicpc.net/problem/4806 4806번: 줄 세기 한 줄에 최대 100글자씩 주어진다. 빈 줄이 주어질 수도 있다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 if __name__ == '__main__': cnt = 0 while 1: try : s = input() cnt+=1 except: print(cnt) break cs 2022. 12. 26.
백준 17094 Serious Problem https://www.acmicpc.net/problem/17094 17094번: Serious Problem 2의 등장횟수가 더 많다면 2를 출력하고, e의 등장횟수가 더 많다면 e를 출력한다. 등장횟수가 같다면 "yee"를 출력한다. (큰 따옴표 제외) www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 def sol(s): if s.count('2')>s.count('e'): return 2 elif s.count('2') 2022. 12. 26.
백준 17010 Time to Decompress https://www.acmicpc.net/problem/17010 17010번: Time to Decompress The output should be L lines long. Each line should contain the decoding of the corresponding line of the input. Specifically, if line i+1 of the input contained N x, then line i of the output should contain just the character x printed N times. www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(n, s): n = int(n) print(s*n) if __name__ == '__.. 2022. 12. 26.