当前位置:网站首页>High precision factorial
High precision factorial
2022-07-01 09:39:00 【Sky upstream】
Description
use High precision method , seek N!N! The exact value of (NN Enter as normal integer ).
Input
10
Output
3628800
Samples
Input
10
output
3628800
#include<bits/stdc++.h>
using namespace std;
long long a[1000001],m,n,i,j,k,l=1,x;//l Length ;
int main()
{
cin>>n;
for(i=1;i<=1000;i++)// Here for the sake of time 1000;
{
a[i]=0;
}
a[1]=1;
for(i=1;i<=n;i++)
{
x=0;
for(j=1;j<=l;j++)
{
a[j]=a[j]*i+x;
x=a[j]/10;
a[j]=a[j]%10;
}
while(x>0)
{
l++;
a[l]+=x;
x=a[l]/10;
a[l]=a[l]%10;
}
}
for(i=l;i>=1;i--)
{
cout<<a[i];
}
return 0;
}
In fact, the basic principle of utilization is : A character array , An operation , loop ;
You can try to debug the program to explore ;
边栏推荐
猜你喜欢
随机推荐
Spark's action operator
2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data
Learning practice: comprehensive application of cycle and branch structure (II)
How to realize the usage of connecting multiple databases in idel
Tree structure --- binary tree 1
Computer USB, HDMI, DP various interfaces and speeds
架构实战营 模块九:设计电商秒杀系统
奇怪,为什么ArrayList初始化容量大小为10?
闭包实现迭代器效果
Dotnet console uses microsoft Maui. Getting started with graphics and skia
OSPF - virtual link details (including configuration commands)
电脑USB、HDMI、DP各种接口及速度
JS原型链
【leetcode】287. Find duplicates
微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
dsPIC30F6014a LCD 方块显示
[unity rendering] customized screen post-processing
Youqitong PE toolbox [vip] v3.7.2022.0106 official January 22 Edition
Log4j log framework
js原型陷阱





![[pytorch] 2.4 convolution function nn conv2d](/img/eb/382a00af5f88d5954f10ea76343d6e.png)


