#include <stdio.h>
int main(void) {
int a,b;
b=a;
for(;a==1;){
a=(a/10)*(a/10)+(a%10)*(a%10);
if(a==b){
printf("%dはアンハッピーナンバーです\n",a
); break;
}
if(a==1){
break;
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CglpbnQgYSxiOwoJc2NhbmYoIiVkIiwmYSk7CgliPWE7Cglmb3IoO2E9PTE7KXsKCSBhPShhLzEwKSooYS8xMCkrKGElMTApKihhJTEwKTsKCSBpZihhPT1iKXsKCSAJcHJpbnRmKCIlZOOBr+OCouODs+ODj+ODg+ODlOODvOODiuODs+ODkOODvOOBp+OBmVxuIixhKTsKCSAJYnJlYWs7CgkgfQoJIGlmKGE9PTEpewoJIHByaW50ZigiJWTjg4/jg4Pjg5Tjg7zjg4rjg7Pjg5Djg7zjgafjgZlcbiIsYSk7CgkgYnJlYWs7CgkgfQoJfQoJcmV0dXJuIDA7Cn0K