My code for this problem( http://www.codechef.com/problems/IOPC13D ) is :-
#include<iostream>
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
if(n%3==0 || n%2==0) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
This code of mine is giving a TLE whereas , the peice of code given below got an AC
#include<iostream>
using namespace std;
int main()
{
int t, n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if(n%2==0 || n%3==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
I fail to understand why I got a TLE. Help please!