AC代码: (质因数分解)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
long long solve(long long n)
{
long long sum = 0;
while(n)
{
sum = sum + (n%10);
n = n/10;
}
return sum;
}
int main()
{
int i;
long long n;
while(cin>>n)
{
long long int k = 0, k1 = solve(n);
for(i = 2;n!=1;i++)
{
if(n%i==0)
{
k = k + solve(i);
n = n/i;
i--;
}
}
if(k==k1)
printf("1\n");
else
printf("0\n");
}
return 0;
}