Torry的困惑(基本型)

 1 #include <cstdio>
 2 
 3 #include <cmath>
 4 using namespace std;
 5 
 6 bool isprime(int x)
 7 {
 8     int i;
 9     for(i=2;i<=sqrt((double)x);i++)
10     {
11         if(x%i==0)
12         return false;
13     }
14     return true;
15 }
16 int main()
17 {
18     int n,i,cn,cj;
19     while(~scanf("%d",&n))
20     {
21         cj=1;
22         for(i=2,cn=0;cn<n;i++)
23         {
24             if(isprime(i))
25             {
26                 cj=(cj*i)%50000;
27                 cn++;
28             }
29             
30         }
31         printf("%d\n",cj);
32     }
33     return 0;
34 }
View Code

 

posted on 2016-01-18 22:16  青春的梦想付诸行动  阅读(123)  评论(0编辑  收藏  举报

导航