알고리즘/백준2021. 7. 25. 14:30[java] 백준 2581번 소수
문제 조건 1. M이상 N이하의 자연수 중 소수인 것을 모두 찾아 첫째 줄에 합 2. 둘째 줄에 1번 조건의 소수 중 최솟값 출력 3. M이상 N이하의 자연수 중 소수가 없을 경우 첫째 줄에 -1 출력 import java.util.Scanner; // 2581 class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int M = sc.nextInt(); int N = sc.nextInt(); int[] arr = new int[N]; int count, tot=0, sosuCount=0; for(int i=M; i