Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int fuck( int n ){
- int sum = 0;
- while( n ){
- int c = n % 10;
- sum += c * c;
- n /= 10;
- }
- return sum;
- }
- int main(){
- int t , n;
- cin >> t;
- while( t-- ){
- cin >> n;
- while( n > 9 ) n = fuck( n );
- if( n == 1 ) puts("Happy");
- else puts("Not Happy");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement