题目链接: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. Spring定时器的两种实现方式

    有两种流行Spring定时器配置:Java的Timer类和OpenSymphony的Quartz. 1.Java Timer定时 首先继承java.util.TimerTask类实现run方法 imp ...

  2. APP投资 历史 十万到 十亿元的项目

    马云又投了课程表APP 1亿元.   还能输入106字 http://www.tuicool.com/articles/ARVN3qI#0-qzone-1-41007-d020d2d2a4e8d1a3 ...

  3. JS中 try...catch...finally (转)

    JS的try..catch..finally var array = null; try { document.write(array[0]); } catch(err) { document.wri ...

  4. 研究jenkins集成unittest成图

    jenkins搭建完毕,unittest代码编写完毕,触发unittest执行测试的脚本和任务编写完毕,接下来研究生成的结果在页面的可视化. 方案: highcharts 参考资料: http://b ...

  5. ITIL也玩“太极拳”

    近期看到一篇老外写的发布管理的培训材料,其中把发布管理比喻成中国太极图中的“阴”,把变 更管理比喻成“阳”,觉得还挺有意思.之所以这么比喻是因为,他认为“发布”是被动的,接受的,有女性阴柔的一面:而“ ...

  6. RxJava中的doOnSubscribe默认运行线程分析

    假设你对RxJava1.x还不是了解,能够參考以下文章. 1. RxJava使用介绍 [视频教程] 2. RxJava操作符   • Creating Observables(Observable的创 ...

  7. tomcat 的 server.xml配置文件

    tomcat的配置文件在其安装后生成的conf目录下,其中主配置文件便是conf下的server.xml文件. server.xml文件由server->service->engine-& ...

  8. SqlServer当前月份时间

    SqlServer当前月份时间 SELECT -DAY(getdate()+-DAY(getdate()))

  9. NetBpm 示例:请假审批(6)

    转载注明出处: http://www.cnblogs.com/anbylau2130/p/3877983.html 原文: 请假示例 流程定义包源码下载(注:par包就是zip格式压缩包).原文地址: ...

  10. Python easyGUI 登录框 非空验证

    import easygui as g msg='欢迎注册' title='注册' fieldNames=['*用户名','*密码','*重复密码','真实姓名','手机号','QQ','e-mail ...