ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1086. Cryptography

Why I always get crash!!!!!!!!!!!!
Posted by kkk 15 May 2002 19:19
Here is my resources
#include<stdio.h>
#include<math.h>
main()
{
  long a[15000],i,j,sum;
  int state,n,k;
  a[0]=2;
  a[1]=3;
  sum=1;
  for(i=5;i<170000,sum<15000;i++)
    {
    for(j=2;j<=sqrt(i);j++)
     {
      state=1;
      if(i%j==0)
    {
      state=0;
      break;
     }
       }

     if(state)
      {
       sum++;
       a[sum]=i;
       }
    }
 scanf("%d",&n);
 for(i=0;i<n-1;i++)
  {
    scanf("%d",&k);
    printf("%ld\n",a[k]);
   }
 scanf("%d",&k);
 printf("%d",a[k-1]);
}


Thank you if anyone who can help me!!!