Problem: Contest Page | CodeChef
DIFFICULTY:
EASY.
PROBLEM:
The chef was busy in solving algebra, he found some interesting results, that there are many numbers which can be formed by the sum of the factorial of the digits, he wrote all those interesting numbers in the diary(in increasing order) and went to sleep. Cheffina came and stole his diary, in morning chef found that his diary is missing. Now the chef wants your help to find those numbers, Chef asks you whether N is that interesting number or not. If N is an interesting number then print 1. Else print 0.
Program:
#include<bits/stdc++.h>
using namespace std;
int main()
{
//code
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t--){
int i;
cin>>i;
if(i==1 || i==2 || i== 145 || i== 40585 )cout<<1<<"\n";
else cout<<0<<"\n";
}
return 0;
}