python-algorithm1422 백준 4659 비밀번호 발음하기 https://www.acmicpc.net/problem/4659 4659번: 비밀번호 발음하기 좋은 패스워드를 만드는것은 어려운 일이다. 대부분의 사용자들은 buddy처럼 발음하기 좋고 기억하기 쉬운 패스워드를 원하나, 이런 패스워드들은 보안의 문제가 발생한다. 어떤 사이트들은 xvtp www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 def first(s): vowel=['a','e','i','o','u'] for i in s: if i in vowel: return True return False def second(s): .. 2022. 10. 27. 백준 2303 숫자 게임 https://www.acmicpc.net/problem/2303 2303번: 숫자 게임 N명이 모여 숫자 게임을 하고자 한다. 각 사람에게는 1부터 10사이의 수가 적혀진 다섯 장의 카드가 주어진다. 그 중 세 장의 카드를 골라 합을 구한 후 일의 자리 수가 가장 큰 사람이 게임을 이 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 from itertools import combinations n=int(input()) answer=[] for i in range(n): nums = list(map(int, input().split())) mymax=0 for nums_com in (list(combinations(nums, 3))): if mymax 2022. 10. 27. 백준 10174 팰린드롬 def sol(s): if s.lower() == s[::-1].lower(): print("Yes") else: print("No") n=int(input()) for i in range(n): s = input() sol(s) https://www.acmicpc.net/problem/10174 10174번: 팰린드롬 팰린드롬은 앞으로 읽으나 뒤로 읽으나 똑같은 단어나 숫자들을 말한다. 일반적으로 대소문자를 구분하지 않지만, 공백은 구분한다. 다음은 팰린드롬의 예시이다. Anna Harrah Arora Nat tan 9998999 123 www.acmicpc.net 문자열 슬라이스 [start:end:step]을 활용해 [::-1]과 같이 사용하면 거꾸로 문자열을 읽는것과 같습니다 You can use.. 2022. 10. 27. 백준 2635 수 이어가기 https://www.acmicpc.net/problem/2635 2635번: 수 이어가기 첫 번째 수가 주어진다. 이 수는 30,000 보다 같거나 작은 양의 정수이다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 first=int(input()) cnt=0 answer_list=[] for i in range(1, first+1): second=i nums=[first,second] while nums[-2]-nums[-1]>=0: nums.append(nums[-2]-nums[-1]) if len(nums)>cnt: answer_list=nums cnt=len(nums) print(cnt) print(*answer_list) cs 브루트포스로 해결하시면 됩니다!.. 2022. 10. 27. 백준 16395 파스칼의 삼각형 https://www.acmicpc.net/problem/16395 16395번: 파스칼의 삼각형 파스칼의 삼각형은 이항계수를 삼각형 형태로 배열한 것인데, 블레즈 파스칼(1623-1662)을 따라 이름 붙여졌다. 단순한 형태로, 파스칼의 삼각형은 다음과 같은 방법으로 만들 수 있다. N번째 행 www.acmicpc.net 1 2 3 4 5 from math import factorial n,k=map(int, input().split()) print(int(factorial(n-1)/(factorial(k-1)*factorial(n-1-(k-1))))) Colored by Color Scripter cs 전형적인 DP 문제긴 한데.. 수학적으로 푸는게 더 빨라요 nCr = n!/ (r!*(n-r)!) .. 2022. 10. 27. 백준 5613 계산기 프로그램 https://www.acmicpc.net/problem/5613 5613번: 계산기 프로그램 입력의 각 줄에는 숫자와 +, -, *, /, =중 하나가 교대로 주어진다. 첫 번째 줄은 수이다. 연산자의 우선 순위는 생각하지 않으며, 입력 순서대로 계산을 하고, =가 주어지면, 그때까지의 결과를 출 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 operation='('+str(input()) while 1: s=input() if s=='=': break operation += s if s.isnumeric(): operation+=')' if operation.count('(') 문자열대로 실행하는 함수 나누기는 문제 조건상 소숫점 버려야함(Line 11) Use eval.. 2022. 10. 26. 백준 4447 좋은놈 나쁜놈 def sol(names): for i in names: g_cnt=i.lower().count('g') b_cnt = i.lower().count('b') if g_cnt>b_cnt: answer='GOOD' elif g_cnt 2022. 10. 26. 백준 25784 Easy-to-Solve Expressions https://www.acmicpc.net/problem/25784 25784번: Easy-to-Solve Expressions When one looks at a set of numbers, one usually wonders if there is a relationship among them? This task is more manageable if there are only three numbers. Given three distinct positive integers, you are to determine how one can be computed using the othe www.acmicpc.net 1 2 3 4 5 6 7 8 nums=list(map(int, input().split())) .. 2022. 10. 26. 백준 25704 출석 이벤트 https://www.acmicpc.net/problem/25704 25704번: 출석 이벤트 쇼핑몰에서 30일간 출석 이벤트를 진행한다. 쇼핑몰의 사이트를 방문하면 1일 1회 출석 도장을 받을 수 있고, 출석 도장을 여러 개 모아서 할인 쿠폰으로 교환할 수 있다. 출석 도장의 개수에 따 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 n=int(input()) p=int(input()) answer=0 if n=5 and n=10 and n=15 and n=20: answer = min(p-2000,int(p*0.75)) if answer 2022. 10. 26. 백준 9253 스페셜 저지 a=input() b=input() c=input() if c in a and c in b: print("YES") else: print("NO") https://www.acmicpc.net/problem/9253 9253번: 스페셜 저지 답이 맞으면 YES, 틀리면 NO를 출력한다. www.acmicpc.net 문제 조건 상 사용자가 출력한 답이 실제 정답과 길이가 같으므로 사용자가 출력한 문자열이 원래 문자열에 존재하는지 비교하면됨 In this problem, Real Answer has same length to User's answer So You just check User's answer is in Original Strings. 2022. 10. 25. 백준 8949 대충 더해 def sol(s1, s2): ans = '' if len(s1) 2022. 10. 24. 백준 2154 수 이어 쓰기 3 def sol(n): ans = '' for i in range(1, n + 1): ans += str(i) return(ans.find(str(n)) + 1) n=int(input()) print(sol(n)) https://www.acmicpc.net/problem/2154 2154번: 수 이어 쓰기 3 첫째 줄에 N(1 ≤ N ≤ 100,000)이 주어진다. www.acmicpc.net find 함수 쓰시면 쉽게 구현 가능합니다 If you use find() function , It will be easy peasy 2022. 10. 23. 이전 1 ··· 34 35 36 37 38 39 40 ··· 119 다음