标签:fine names stream 逆序输出 cstring += cst 初始化 mes
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
#include<map>
#define MAXN 0x3f3f3f3f
using namespace std;
#include<stdio.h>
int main()
{
int A[100000] = {0};//初始化为0
int B[100000] = {0};
int n;
A[1] = 1;
B[1] = 1;
cin >> n;
for (int i = 2; i <= n;i++)
{
for (int j = 1; j <= 1000;j++)
{
A[j] = A[j] * i;}
for (int j = 1; j <= 100;j++)//进位
{if (A[j] > 9)
{
A[j + 1] += A[j] / 10;
A[j] = A[j] % 10;
}
}
for (int j = 1; j <= 1000;j++)
{
B[j] += A[j];
if(B[j]>9)
{
B[j + 1] += B[j] / 10;
B[j]=B[j]%10;
}
}
}
int h = 100;
while(B[h]==0&&h>1)//去除前导0
{
h--;
}
for (int i = h; i >= 1;i--)//逆序输出
{
cout << B[i];
}
return 0;
}
标签:fine names stream 逆序输出 cstring += cst 初始化 mes
原文地址:https://www.cnblogs.com/a821403286/p/13693724.html