Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Help in Printing Sheets practice problem

$
0
0

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!


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>