题目链接:http://ac.jobdu.com/problem.php?pid=1076

详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus

参考代码:

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <cmath>
#define MAX_SIZE 10010
using namespace std; int n;
int pos[MAX_SIZE]; int main(){
while(~scanf("%d",&n)){
memset(pos,,sizeof(pos));
if(==n){
printf("1\n");
continue;
}
int i,j;
int length = ;
pos[]=;
for(i = ; i <= n ; i++){
int carry = ;
for(j = ; j < length ; j++){
pos[j] = pos[j] * i + carry;
if(pos[j]>=){
carry = pos[j]/;
pos[j] = pos[j]%;
}
else{
carry = ;
}
}
while(carry!=){
pos[length++] = carry % ;
carry/=;
}
}
for(i = MAX_SIZE ; i >= ; i--){
if(pos[i]!=)
break;
}
for(j = i ; j >= ; j--){
printf("%d",pos[j]);
}
printf("\n");
}
return ;
}
/**************************************************************
Problem: 1076
User: zpfbuaa
Language: C++
Result: Accepted
Time:1480 ms
Memory:1560 kb
****************************************************************/

题目1076:N的阶乘(大数乘法)的更多相关文章

  1. 51nod1057-N的阶乘(大数乘法巧解)

    这道大数乘法开始我是想套板子模拟的..然后就发现2/3的例子都wa了.(惊了).然后在思考后发现n2的板子的确过不了这么多的大数.(不看题的下场).所以,我在网上发现了分块求大数的方法.%%% 思路来 ...

  2. 九度OJ 1076 N的阶乘 -- 大数运算

    题目地址:http://ac.jobdu.com/problem.php?pid=1076 题目描述: 输入一个正整数N,输出N的阶乘. 输入: 正整数N(0<=N<=1000) 输出: ...

  3. 51nod 1027大数乘法

    题目链接:51nod 1027大数乘法 直接模板了. #include<cstdio> #include<cstring> using namespace std; ; ; ; ...

  4. 【九度OJ】题目1076:N的阶乘 解题报告

    [九度OJ]题目1076:N的阶乘 解题报告 标签(空格分隔): 九度OJ 原题地址:http://ac.jobdu.com/problem.php?pid=1076 题目描述: 输入一个正整数N,输 ...

  5. [POJ] #1001# Exponentiation : 大数乘法

    一. 题目 Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 156373   Accepted: ...

  6. HDOJ-1042 N!(大数乘法)

    http://acm.hdu.edu.cn/showproblem.php?pid=1042 题意清晰..简单明了开门见山的大数乘法.. 10000的阶乘有35000多位 数组有36000够了 # i ...

  7. 51 Nod 1027 大数乘法【Java大数乱搞】

    1027 大数乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 给出2个大整数A,B,计算A*B的结果. Input 第1行:大数A 第2行:大数B (A,B的长度  ...

  8. 51 Nod 1028 大数乘法 V2【Java大数乱搞】

    1028 大数乘法 V2 基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 给出2个大整数A,B,计算A*B的结果. Input 第1行:大数A 第2行:大数B (A ...

  9. PAT 1023 Have Fun with Numbers[大数乘法][一般]

    1023 Have Fun with Numbers (20)(20 分) Notice that the number 123456789 is a 9-digit number consistin ...

随机推荐

  1. C# 异常和异常处理

    C# 语言的异常处理功能可帮助您处理程序运行时出现的任何意外或异常情况. 异常处理使用 try.catch 和 finally 关键字尝试某些操作,以处理失败情况,尽管这些操作有可能失败,但如果您确定 ...

  2. 分享9款最新超酷HTML5/CSS3应用插件

    新的一周开始了,小编继续要为大家分享实用超酷的HTML5应用,今天分享的这9款最新HTML5/CSS3应用你一定会很喜欢,一起来看看. 1.HTML5 Canvas模拟衣服撕扯动画 超级逼真 今天又要 ...

  3. springboot+shiro整合教程

    进阶教程: 1. springboot+shiro+redis(单机redis版)整合教程 2. springboot+shiro+redis(集群redis版)整合教程 3.springboot+s ...

  4. 移植3.4.2的Kernel到JZ2440

        本文将介绍如何移植linux-3.4.2内核到JZ2440开发板上的全过程,使用的交叉编译工具版本为 arm-linux-gcc-4.3.2.tar.bz2     下面来一步一步介绍如何移植 ...

  5. 小程序笔记四:表单提交form

    index.wxml代码 <form bindsubmit="formSubmit" bindreset="formReset"> <view ...

  6. sar监控工具详解

    转自http://www.cnblogs.com/Amaranthus/p/3745680.html SAR NAME: SAR报告,收集,保存系统活动信息 语法: sar  [ -A ] [ -b ...

  7. Alpine Linux:如何配置GUI的图形桌面环境:x Desktop Environment

    alpine linux 真是不错.小巧.迅捷! 官方的各个版本的alpine镜像内没有带图形环境的.那我们如何构建自己的桌面图形环境呢? 其实:这个问题,在起官网的wiki内有指南,我们根据那些相关 ...

  8. UnitOfWork 更新实体出错解决办法

    用UnitOfWork进行实体更新的时候,再查询实体一次,再去更新的时候会报如下错误: Attaching an entity of type 'TinyFrame.Data.DomainModel. ...

  9. 常见bootloader介绍

    https://blog.csdn.net/weibo1230123/article/details/82716818 http://fasight001.spaces.eepw.com.cn/art ...

  10. tomcat启动时出现了Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]

    https://blog.csdn.net/imjcoder/article/details/78725267 <dependency> <groupId>org.spring ...