1
import java.util.Arrays; import java.util.Scanner; public class Main { public static int MAX = 1500000 ; // 保证此数内有100000个素数即可 public static int[] su = new int[MAX]; public static int[] db = new int[MAX]; public static int cnt = 0; //素数打表 public static void dabiao() { for(int i = 2; i < MAX; i++) { if(db[i] == 0) { su[cnt++] = i; } for(int j = i + i; j < MAX; j+=i){ db[j] = 1; } } // System.out.println(cnt); } public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); dabiao(); int n = cin.nextInt(); int ans = 1; for(int i = 0; i < n; i++) { ans = ans * su[i] % 50000; } System.out.println(ans); } }
样例输出
2
原文:https://www.cnblogs.com/zhumengdexiaobai/p/10422690.html