大数
老鼠哎大米
这个作者很懒,什么都没留下…
展开
-
SDJZU oj N的N次方
题目描述 现给你一个正整数N,请问N^N的最左边的数字是什么? 输入格式 输入包含多组测试数据。每组输入一个正整数N(N 输出 对于每组输入,输出N^N的最左边的数字。 样例输入 3 4 样例输出 2 2 #include #include #include using namespace std; int vis(double n) { double in原创 2013-08-07 10:25:30 · 1651 阅读 · 1 评论 -
HDU 1060 Leftmost Digit
Problem Description Given a positive integer N, you should output the leftmost digit of N^N. Input The input contains several test cases. The first line of the input is a single integer T whi原创 2013-08-07 10:26:26 · 514 阅读 · 0 评论 -
阶乘之和
输入n,计算S=1!+2!+3!+……+n!的末六位(不含前导0).n 输入:10 输出:37913 PS:由题意可知,只求后六位,所以只要S>=6位数,则S不变了. #include using namespace std; int main() { int n; const int mod=1000000; int sum=0;原创 2013-08-08 11:28:01 · 612 阅读 · 0 评论 -
大数的加减乘除、取对数、求次方、进制转换、三角函数的原理
以下是大数运算的算法,没有经过科学论证,也没有参考算法书,只是自己想的,如果你有更快的算法,请也给我一份,让我参考一下. 说明: 1、以下说的大数运算均是针对是大自然数的运算,至于负数大数的运算,我想只要实现了正数大数的运算,负数的大数的运算应该不难吧. 2、第1点已经说了,这是针对整数的大数的运算,对于有小数的情况,请注意移位操作.例如3.5*4.5在大数里的运算是35*45,在原创 2013-08-01 14:05:51 · 5031 阅读 · 1 评论 -
HDU 1002 A + B Problem II大数相加
Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=原创 2013-08-01 16:57:06 · 570 阅读 · 0 评论 -
HDU&&NYoj N!
One N in one line, process to the end of file. Output For each N, output N! in one line. Sample Input 1 2 3 Sample Output 1 2 6描述我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?输原创 2013-08-10 00:06:07 · 597 阅读 · 0 评论 -
阶乘的准确值
输入不超过1000的正整数n,输出n!=1*2*3*4*......*n的精确结果。 输入:30 输出:265252859812191058636308480000000 PS:为了保存结果,分析1000!有多大,因此可以用一个3000个元素的数组f保存,为了方便进位,我们用f[0]表示个位,f[1]表示十位,f[2]表示百位........(逆位储存,进位的时候可以简单表示),注意原创 2013-08-14 14:54:54 · 735 阅读 · 0 评论 -
非常好用的大数类模板 Bignum
#include #include #include #include using namespace std; #define MAXN 9999 #define MAXSIZE 10 #define DLEN 4 class BigNum { private: int a[500]; //可以控制大数的位数 int len; //大数长度 public:转载 2014-02-19 10:09:09 · 1615 阅读 · 0 评论 -
hdu 1001 Sum Problem
Problem Description Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n. Input The input will consist of原创 2013-08-04 10:09:53 · 566 阅读 · 0 评论 -
HDU 1018 Big Number
Problem Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are原创 2013-07-31 11:09:32 · 571 阅读 · 0 评论