Problem code: PALIN
ID: 9841432
Please tell me how can I make it more compact.
It shows time limit exceeded.
created
last reply
- 4
replies
- 991
views
- 5
users
Problem code: PALIN
ID: 9841432
Please tell me how can I make it more compact.
It shows time limit exceeded.
This is my code for prime generator (Time Limit exceeded)
#include
using namespace std;
int main()
{int t;
cin>>t;
long long int a[t],b[t];
for(int i=0;i<t;i++)
cin>>a[i]>>b[i];
for(int i=0;i<t;i++)
{
for(int j=a[i];j<=b[i];j++)
{
int c=0;
for(int k=2;k<j;k++)
{
if(j%k!=0)
c++;
}
if(c==j-2)
cout<<j<<endl;
}
cout<<endl;
}
return 0;
}
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
SPTTRN1 - Straight Line Spiral Pattern (Act 1) | C and C++ | 0 | 17 | 10d |