标签:style blog io color os for sp div on
#include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> #include<cmath> #include<queue> using namespace std; const int Max=1000; int Top=1,Mtop=0,add[Max]; int High(int a) { add[1]+=a; Top = 1; Mtop=max(Top,Mtop); while(add[Top]>10){ add[Top+1]+=add[Top] / 10; add[Top] = add[Top] % 10; Top++; } if(add[Top+1]>0) Top++; } int Num[Max] , maxtop=1; void Motiply ( int a ) { for(int i = 1 ; i <= Top ;i++ ){ Num[i] *= a; } for(int i=1;i<=Top;i++){ Num[i+1] += Num[i] / 10; Num[i] = Num[i] % 10; } if(Num[Top+1]>=0) Top++; while(Num[Top]>=10) { Num[Top+1] += Num[Top] / 10; Num[Top] = Num[Top] % 10; Top++; } if(Num[Top]==0) Top--; } int main() { int a,n; memset(add,0,sizeof(add)); scanf("%d",&n); memset(Num,0,sizeof(Num)); Num[1]=1;Top=1; for(int i=1;i<=n;i++){ scanf("%d",&a); Motiply(a); } //cout<<Top<<endl; for(int i=Top;i>=1;i--) cout<<Num[i]; cout<<endl; return 0; }
标签:style blog io color os for sp div on
原文地址:http://www.cnblogs.com/coutendl/p/4079850.html