Problem: Contest Page | CodeChef
DIFFICULTY:
EASY.
PROBLEM:
Chef has a number N, Cheffina challenges the chef to check the divisibility of all the permutation of N by 3. If any of the permutations is divisible by 3 then print 1 else print 0.
Program:
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,t;
cin>>t;
for(int i=1;i<=t;i++)
{
int n;
cin>>n;
if(n%3==0)cout<<1<<"\n";
else cout<<0<<"\n";
}
}