일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 다이나믹프로그래밍
- ㅂ
- topdown
- opic
- XML
- 오픽공부법
- 안드로이드
- 이진탐색 #나무 자르기
- English
- dynamicProgramming
- 영어회화
- XML주석
- 탑다운
- 메모이제이션
- 영어말하기
- 오픽노잼
- 오픽가격
- dp
- 안드로이드주석
- 오픽노잼공부방법
- 주석
- fibo
- 이진탐색
- 오픽
- 디피
- stack 스택
- 바텀업
- 피보나치수열
- 오픽점수잘받는방법
목록PS (254)
RUBY

출처:: www.acmicpc.net/problem/2004 분류:: 수학 1. 문제 이해 및 해결과정 -n이 20억이다. 조합식으로 계산하는 코드를 만들었는데, 시간초과다 - 0이 생기는 경우를 고민해보면, 10은 즉, 2과 5의 곱으로 만들어진다 - 조합에서 0이 되려면 약분 후에 10의 배수(2*5)가 분자에 있으면 된다 - nCm = n! / m! (n-m)! 팩토리얼부분을 분자 A, 분모 B,C 라고 하면 A,B,C가 2로 나누어떨어지는 횟수를 구하여 A-(B+C)를 하고 , 5로 나누어 떨어지는 횟수를 A-(B+C) 를 하여 더 작은 값이 답이 된다. 2. 풀이방법 1. #조합 0의 개수 #https://www.acmicpc.net/problem/2004 import sys sys.stdin ..
출처:: www.acmicpc.net/problem/1373 분류:: 1. 문제 이해 및 해결과정 2. 풀이방법 1. #2진수 8진수 #https://www.acmicpc.net/problem/1373 import sys sys.stdin = open("input.txt","r") input=sys.stdin.readline print(oct(int(input(), 2))[2:]) #0x .... 3. 오답원인 4. 알게된 점 다른진수의 문자열을 숫자로 변환 int(str,2) #2진수의 문자열을 10진수 숫자로 int(str,8) #8진수의 문자열을 10진수 숫자로 int(str,16) #16진수의 문자열을 10진수 숫자로 숫자에서 다른진수의 문자열로 변환 bin(num) #숫자형 num을 2진수 문자..
출처:: www.acmicpc.net/problem/17103 분류:: 1. 문제 이해 및 해결과정 2. 풀이방법 #골드바흐 파티션 #https://www.acmicpc.net/problem/17103 import sys import math sys.stdin = open("input.txt","r") input=sys.stdin.readline t=int(input()) maxv= 1000000 sosu=[True]*(maxv+1) for i in range(2,int(math.sqrt(maxv))+1): #에라토스테네스의 체로 소수배열 구해두기 if sosu[i]: j=2 while i*jn-i: break if sosu[i]==True and sosu[n-i]==True: # 두 소수의 합 cnt+..
출처:: www.acmicpc.net/problem/9613 분류:: 유클리드 1. 문제 이해 및 해결과정 2. 풀이방법 1. 유클리드 #GCD 합 #https://www.acmicpc.net/problem/9613 import sys from itertools import combinations sys.stdin = open("input.txt","r") input=sys.stdin.readline t=int(input()) for _ in range(t): arr=list(map(int,input().split())) selected=list(combinations(arr[1:],2)) gcd = [] #gcd저장 for a,b in selected: #가능한 쌍에서 if a==0 or b==0: c..
출처:: www.acmicpc.net/problem/6588 분류:: 수학 1. 문제 이해 및 해결과정 2. 풀이방법 1. 에라토스테네스의 체 #골드바흐의 추측 #https://www.acmicpc.net/problem/6588 import sys import math maxv=1000000 sosu=[True]*(maxv+1) sosu[1]=False for i in range(2,int(math.sqrt(maxv))+1): #소수구하기 if sosu[i]: j=2 while i*j
출처:: www.acmicpc.net/problem/1934 분류:: 유클리드 호제법 1. 문제 이해 및 해결과정 - 유클리드 호제법 int gcd(int a, int b) { while (b > 0) { int tmp = a; a = b; b = tmp%b; } return a; } 2. 풀이방법 1. 유클리드 호제 #최소공배수 #https://www.acmicpc.net/problem/1934 import sys sys.stdin = open("input.txt","r") n=int(input()) def LCD(a,b): x,y=a,b while a>0:#16 (6,10)=6*1+4 ->(4,6)=4*1+2 ->(2,4)=2*2+0 ->(0,2) (나머지,나누는 수) # print(a, b) tmp..
출처:: www.acmicpc.net/problem/1212 분류:: 1. 문제 이해 및 해결과정 2. 풀이방법 #8진수 2진수 #https://www.acmicpc.net/problem/1212 import sys sys.stdin = open("input.txt","r") input=sys.stdin.readline print(bin(int(input(),8))[2:]) 3. 오답원인 4. 알게된 점

출처:: www.acmicpc.net/problem/2089 분류:: 1. 문제 이해 및 해결과정 2. 풀이방법 1. #-2진수 #https://www.acmicpc.net/problem/2089 import sys sys.stdin = open("input.txt","r") input=sys.stdin.readline n=int(input()) res=[] if n==0: print('0') exit(0) while n: # print(n) if n%-2: #나머지 있으면 n=n//-2+1 res.append('1') else: n=n//-2 res.append('0') print(''.join(reversed(res))) 3. 오답원인 - 0일때 처리안해서 틀림 4. 알게된 점