두 포인터 3

백준(JAVA) 1644번 소수의 연속합 풀이

Java으로 구현한 1644번 소수의 연속합 문제 풀이입니다. https://www.acmicpc.net/problem/1644 1644번: 소수의 연속합 첫째 줄에 자연수 N이 주어진다. (1 ≤ N ≤ 4,000,000) www.acmicpc.net import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); boolean[] flag = new bool..

백준(Python) 1644번 소수의 연속합 풀이

Python으로 구현한 1644번 소수의 연속합 문제 풀이입니다. https://www.acmicpc.net/problem/1644 1644번: 소수의 연속합 첫째 줄에 자연수 N이 주어진다. (1 ≤ N ≤ 4,000,000) www.acmicpc.net n = int(input()) is_prime = [False, False] + [True] * (n - 1) prime_list = [] for i in range(2, n + 1) : if is_prime[i] : prime_list.append(i) for j in range(i+i, n + 1, i) : is_prime[j] = False result = 0 start = 0 end = 0 while end

백준(Python) 11597번 Excellence 풀이

Python으로 구현한 11597번 Excellence 문제 풀이입니다. https://www.acmicpc.net/problem/11597 11597번: Excellence The World Coding Federation is setting up a huge online programming tournament of teams comprised of pairs of programmers. Judge David is in charge of putting teams together from the Southeastern delegation. Every student must be placed on exactly one team www.acmicpc.net n = int(input()) data = [] ..