解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class C1485 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { F(sc.nextInt()); } sc.close(); } private static void F(int n){ long sum = 1; int a = 2; int count = 0; while(count < n){ if(isSu(a)){ //(a*b)%k = ((a%k)*(b%k)%k sum = (sum * (a%50000))%50000; count++; } a++; } System.out.println(sum); } private static boolean isSu(int n){ for(int i = 2; i*i <= n; i++){ if( n % i == 0) return false; } return true; } }
0.0分
0 人评分