Subscribe Us

Responsive Advertisement

Advertisement

903A Hungry Student Problem codeforces solution by

 

903A  Hungry Student Problem codeforces solution by 

ujjal roy




#include<bits/stdc++.h>

using namespace std;

main()

{

    int t,x,temp;

    cin>>t;

    while(t--)

    { int c=0;

        cin>>x;

        if(x%3==0||x%7==0) cout<<"YES"<<endl;

        else

        {


            while(1)

            {   temp=x;

                  x-=3;

                 temp-=7;

                 if(x<=0&&temp<=0) break;


                if((x>0&&temp>0)&&(x%7==0||temp%3==0))

                {

                    cout<<"YES"<<endl;

                    c=1;

                    break;

                }

            }



            if(c==0)cout<<"NO"<<endl;

        }




    }



    return 0;

}


Post a Comment

0 Comments