|
|
back to boardRTE in Test #1. #include <iostream> using namespace std; int prime[15001]; bool num[163848]; void sieve() { num[2]=true; prime[1]=2; long int i,j,k; for(i=3;i<163848;i+=2) num[i]=1; for(i=2,j=3;i<=15000;j+=2) { if(num[j]) { for(k=j;k*j<=163848;k+=2) num[k*j]=0; prime[i]=j; i++; } } } int main() { sieve(); int t; cin>>t; while(t--) { int m; cin>>m; cout<<prime[m]<<endl; } } Why am I getting RTE in test #1? Edited by author 13.09.2019 08:33 Re: RTE in Test #1. Edited by author 18.08.2019 21:37 What is the size of int in Timus? What is the size of int in this oj? 2 or 4 Bytes? |
|
|