当前位置:网站首页>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 ;
边栏推荐
- Get the list of a column in phpexcel get the letters of a column
- 电脑USB、HDMI、DP各种接口及速度
- Closure implementation iterator effect
- 2.2 【pytorch】torchvision. transforms
- Solution of EPS image blur by latex insertion
- The market is relatively weak recently
- 嵌入式开发用到的一些工具
- 奇怪,为什么ArrayList初始化容量大小为10?
- Upload labs for file upload - white box audit
- Swift control encapsulation - paging controller
猜你喜欢

Who has the vision to cross the cycle?

Error org apache. catalina. core. StandardContext. FilterStart start filter exception

吃一个女富豪的瓜。。。

Construction of esp8266 FreeRTOS development environment

2.2 【pytorch】torchvision. transforms

Implementation and application of queue

Preparing for the Blue Bridge Cup -- bit operation

js作用域链与闭包

【pytorch】nn. Crossentropyloss() and nn NLLLoss()

主流实时流处理计算框架Flink初体验
随机推荐
韦东山板子编译内核问题解决
Flinkv1.13 implementation of financial anti fraud cases
Computer USB, HDMI, DP various interfaces and speeds
华为帐号多端协同,打造美好互联生活
队列的实现和应用
[pytorch learning] torch device
闭包实现迭代器效果
富文本实现插值
node. How to implement the SQL statement after JS connects to the database?
Dotnet console uses microsoft Maui. Getting started with graphics and skia
树结构---二叉树1
那个程序员,被打了。
嵌入式开发用到的一些工具
Flinkv1.13实现金融反诈骗案例
[untitled]
Day06 branch structure and cycle (III)
【pytorch】nn. AdaptiveMaxPool2d
Strange, why is the ArrayList initialization capacity size 10?
UE small knowledge point controller possess pawn process
电脑USB、HDMI、DP各种接口及速度