第一眼看~~矩阵乘法~~再看范围~~根本不需要~~~直接高精度做到99就ok了...当然可以开99个数组来存99个高精度数...但每个数只与其前面的三个数有关..所以我是用的滚动数组...如A3就覆盖了A0..A4覆盖了A1..A5覆盖了A2..A6覆盖了A0........
#include<iostream>
#include<queue>
#include<stdio.h>
#include<math.h>
#define oo 200000000
using namespace std;
int A[3][33],now,x,i,k;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
while (~scanf("%d",&x))
{
memset(A,0,sizeof(A));
i=0;
while (x) { A[0][i++]=x%10; x/=10; }
scanf("%d",&x);
i=0;
while (x) { A[1][i++]=x%10; x/=10; }
scanf("%d",&x);
i=0;
while (x) { A[2][i++]=x%10; x/=10; }
now=2;
for (k=3;k<=99;k++)
{
now=(now+1)%3;
for (i=0;i<=30;i++)
{
A[now][i]+=A[(now+1)%3][i]+A[(now+2)%3][i];
if (A[now][i]>9)
{
A[now][i+1]+=A[now][i]/10;
A[now][i]%=10;
}
}
}
for (i=30;i>=0;i--)
if (A[now][i]) break;
for (;i>=0;i--) printf("%d",A[now][i]);
printf("\n");
}
return 0;
}