P1134高精度

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    while(cin>>N)
    {
        int a[3001]={0};
        int i=0;
        a[0]=1;
        while(N)
        {
            for(i=0;i<3001;i++)
            {
                if(a[i]>=10)
                {
                    a[i+1]+=a[i]/10;
                    a[i]%=10;
                }
                a[i]*=N;
            }
            N--;
        }
        while(a[i]==0)
        {
            i--;
        }
        for(;i>=0;i--)
            cout<<a[i];
        cout<<endl;
    }
    system("pause");
}

 

posted @ 2023-05-13 23:24  刘海烽  阅读(23)  评论(0)    收藏  举报