Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process to the end of file.OutputFor each N,...
分类:
其他好文 时间:
2015-02-07 11:43:17
阅读次数:
128
在这里,我们约定,能用int表示的数据视为单精度,否则为高精度。所有函数的设计均采用带返回值的形式。
本文包含
1.高精度加法
2.高精度减法
3.高精度乘法
1)高精度乘高精度的朴素算法
2)高精度乘高精度FFT优化算法
3)高精度乘单精度
4.高精度除法
1)高精度除高精度
2)高精度除单精度
5.高精度取模
1)高精度对高精度取模
2)高精度对单精度取模
6.高精...
分类:
其他好文 时间:
2015-02-01 20:30:23
阅读次数:
4008
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【分析】
高精度乘法(大数乘法)
【代码】
/***...
分类:
其他好文 时间:
2015-01-28 13:02:52
阅读次数:
165
#include #include int main(){ char a[101],b[101]; int i,j,k,cas,count=1,num2,num3; scanf("%d",&cas); getchar(); while (cas--) { ...
分类:
其他好文 时间:
2015-01-09 20:45:02
阅读次数:
117
贴个渣模板
CODE:
#include
#include
#include
#include
#include
#define MAX 140010
#define PI 3.1415926535897932384626
using namespace std;
struct Complex{
double real,imag;
Complex(double ...
分类:
其他好文 时间:
2014-12-26 11:13:29
阅读次数:
216
渣模板,不知为何常数还挺大。。
CODE:
#include
#include
#include
#include
#include
#define MAX 200010
#define PI 3.1415926535897932384626
using namespace std;
struct Complex{
double real,imag;
Compl...
分类:
其他好文 时间:
2014-12-26 11:13:24
阅读次数:
155
(接上篇http://www.cnblogs.com/daipeiwu/p/4134694.html)重写* 1 BigInteger operator * (const BigInteger& b){ 2 BigInteger c,d; 3 c.s.clear();...
分类:
其他好文 时间:
2014-12-09 21:08:19
阅读次数:
400
SGU112 a^b-b^a
题目大意:
给你两个自然数a和b.求a^b-b^a.
输入
输入两个数 a 和 b (1≤a,b≤100).
输出
输出所求的答案.
样例输入
2 3
样例输出
-1
题目意思很好理解。
方法也很简单。
1.高精度乘法计算(大整数*大整数)。
2.套用快速幂(原理一样,即a^b=(a^(b/2))^2;(b...
分类:
其他好文 时间:
2014-11-26 11:34:36
阅读次数:
205
这是写给自己看的模板……当然有需要的人也可以直接拿走1、封装好的高精度模板注意:算法的主要耗时在于高精度乘法、除法和乘方。其中高精度乘方有快速幂优化,常数大致是乘法的5~10倍。除法是用二分写的效率较低,大概是乘法的20~30倍,能不用尽量不用#define mx 300struct gaojing...
分类:
其他好文 时间:
2014-11-15 00:12:59
阅读次数:
126
如果这次noip没考好,完全是因为从7月29日之后就没有再写过程序了。说起来,真是一个泪流满面的事实…那这样一个弱智题练手恢复代码能力,竟然还花了我两个晚上(当然不是两整个晚上…)第一天TLE了,好在我机智,一看到解题里说要压位就自动脑补出压位了。代码风格非常诡异,弱智题竟然写到2KB我也是醉了。p...
分类:
其他好文 时间:
2014-11-05 01:45:42
阅读次数:
377