思路:反正我推不出这公式。。。。root(ab*cd) = a*c+a*d+b*c+b*d = (a+b)*(c+d);
代码如下:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
int boot(int n)
{
int m,sum,a;
sum=0;
while(n)
{
sum+=n%10;
n/=10;
}
if(sum>=10)
boot(sum);
else
return sum;
}
int main()
{
int n;
int k;
int m;
while(scanf("%d",&n) && n)
{
k=boot(n);
m=1;
while(n--)
{
m=boot(m*k);
}
printf("%d\n",m);
}
return 0;
}