![[백준 알고리즘] 10870번 피보나치 수 5 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbaTLle%2FbtqCzCplhXy%2F6fRXb6f7YwmxHHspaeNZ01%2Fimg.png)
N = int(input()) def fibo(N): if N==0: return 0 elif N==1: return 1 return fibo(N-2) + fibo(N-1) print(fibo(N)) ▼ 링크 https://www.acmicpc.net/problem/10870 10870번: 피보나치 수 5 피보나치 수는 0과 1로 시작한다. 0번째 피보나치 수는 0이고, 1번째 피보나치 수는 1이다. 그 다음 2번째 부터는 바로 앞 두 피보나치 수의 합이 된다. 이를 식으로 써보면 Fn = Fn-1 + Fn-2 (n>=2)가 된다. n=17일때 까지 피보나치 수를 써보면 다음과 같다. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1..
![[백준 알고리즘] 10872번 팩토리얼 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fee2fOE%2FbtqCD7VCDWH%2FQuSiDt2RbmfJw324xf5iP0%2Fimg.png)
재귀로 푸는 방법 N = int(input()) def factorial(N): if N 0: factorial *= N N-=1 print(factorial) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); System.out.println(f..
![[백준 알고리즘] 11399번 ATM (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb5xGwT%2FbtqCB8m9Zgr%2FTVuqLoh9RxsnI7AGsgEJr1%2Fimg.png)
import sys N = int(input()) P = list(map(int, sys.stdin.readline().split())) P.sort() sum = 0 for time in P: sum += time * N N -= 1 print(sum) ▼ 링크 https://www.acmicpc.net/problem/11399
![[백준 알고리즘] 1931번 회의실배정(Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbnqPU9%2FbtqCzBxahlX%2Fb9i77F9Bx2lNlWr0sMBj0k%2Fimg.png)
import sys N = int(input()) meeting = [] for _ in range(N): meeting.append(list(map(int, sys.stdin.readline().split()))) meeting = sorted(meeting, key=lambda x : [x[1], x[0]]) #이부분 cnt = 0 max = 0 for i in meeting: if max
![[백준 알고리즘] 11047번 동전 0 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F0dO8o%2FbtqCDkOoTHr%2Fo8PF4eGfHfw15quK3wRvvk%2Fimg.png)
N, K = map(int, input().split()) a = [] for i in range(N): a.append(int(input())) cnt = 0 for i in reversed(a): if K == 0: break if (K // i) >= 1: cnt += (K // i) K -= (i * (K//i)) print(cnt) ▼ 문제링크 https://www.acmicpc.net/problem/11047 11047번: 동전 0 첫째 줄에 N과 K가 주어진다. (1 ≤ N ≤ 10, 1 ≤ K ≤ 100,000,000) 둘째 줄부터 N개의 줄에 동전의 가치 Ai가 오름차순으로 주어진다. (1 ≤ Ai ≤ 1,000,000, A1 = 1, i ≥ 2인 경우에 Ai는 Ai-1의 배수) www...
![[백준 알고리즘] 1065번 한수 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FCYEw2%2FbtqCz5DpgXI%2Fk1cIr5TxHwHABGsibpw9rK%2Fimg.png)
n = int(input()) result = 0 for i in range(1, n + 1): if i
![[백준 알고리즘] 4673번 셀프 넘버 (Python, Java)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FHXc0P%2FbtqCvytwDLF%2Fndm82SNEQWex4PVPTKB7wK%2Fimg.png)
s = set(range(1, 10001)) for i in range(1, 10001): sum = i for ch in str(i): sum += int(ch) if sum in s: s.remove(sum) for i in s: print(i) public class Main { public static int calculate( int n) { int result = n; while (n > 0) { result += (n % 10); n /= 10; } return result; } public static void main(String[] args) { int num_arr[] = new int[10001]; for(int i=1; i
![[백준 알고리즘] 4344번 평균은 넘겠지 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FU07j0%2FbtqCzBCyKfp%2FcbKaA7igCWj77HaoV5mWjk%2Fimg.png)
C = int(input()) for i in range(C): line = input().split() avg, cnt, N = 0.0, 0, int(line[0]) for j in range(1, N+1): avg += int(line[j]) avg /= N for j in range(1, N + 1): if int(line[j]) > avg: cnt += 1 print('%.3f' % (cnt/N*100) +'%') ▼ 링크 https://www.acmicpc.net/problem/4344 4344번: 평균은 넘겠지 문제 대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다. 입력 첫째 줄에는 테스트 케이스의 개수 C가 주어진다. 둘째 줄부터..
![[백준 알고리즘] 8958번 OX퀴즈 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbrik3A%2FbtqCy4dVAtc%2F9r35VuvHrQ8ZlJoDTP6laK%2Fimg.png)
import sys n = int(input()) for i in range(n): line = sys.stdin.readline() cnt = 0 sum = 0 for ch in line: if ch is 'O': cnt += 1 sum += cnt else: #'X' cnt = 0 print(sum) ▼ 링크 https://www.acmicpc.net/problem/8958
![[백준 알고리즘] 1546번 평균 (Python)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGj8sB%2FbtqCvyfVExX%2FBmpHslnPgHVJKJHwwZdk6K%2Fimg.png)
n = int(input()) score = input().split() score = list(map(float, score)) M = max(score) new = [] for i in score: new.append(i / M * 100) sum = 0 for i in new: sum += i print(sum/n) ▼링크 https://www.acmicpc.net/problem/1546