ACM_高精度
ITAK
这个作者很懒,什么都没留下…
展开
-
n个大数加法(高精度)
#include #include #include using namespace std;int dx(char a[]){ int tmp,len; len=strlen(a); for(int i=0;i { tmp=a[i]; a[i]=a[len-1-i]; a[l原创 2015-04-24 22:00:34 · 949 阅读 · 0 评论 -
大数减法
#include #include #include using namespace std;int max(int m,int n){ if(m>n) return m; return n;}int compare(char *str_a,char *str_b){ int len_a, len_b; le原创 2015-04-28 22:31:15 · 624 阅读 · 0 评论 -
大数加法和乘法
#include<iostream>#include<cstdio>#include<cstring>const int Len=5000//大数的长度using namespace std;int Input (char n[])//将大数读入的函数{ char s[Len]; int l; for(int i=0; i<Len; i++) n[i]=0;转载 2015-05-27 17:32:38 · 566 阅读 · 0 评论 -
高精度加法和乘法
今天偶然看了一下某大神的模板,不经意翻到这个就顺便“借”了一下 上代码吧:/*Date : 2015-8-21 晚上Author : ITAKMotto :今日的我要超越昨日的我,明日的我要胜过今日的我;以创作出更好的代码为目标,不断地超越自己。*/#include <iostream>#include <cstdio>#include <cstring>using namespa原创 2015-08-22 20:39:46 · 1225 阅读 · 7 评论 -
高精度求N!
#include <iostream>#include <cstdio>#include <cmath>#include <cstring>using namespace std;typedef long long LL;const LL MOD = 100000000000000;const int MAXN = 40000;LL a[MAXN];int main(){原创 2016-05-06 21:07:05 · 1400 阅读 · 0 评论 -
hdu 1250 Hat's Fibonacci
点击此处即可传送hdu 1250Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(原创 2015-08-13 12:49:53 · 974 阅读 · 0 评论 -
51NOD 1185 威佐夫游戏 V2(博弈论 + 减少精度)
传送门 有2堆石子。A B两个人轮流拿,A先拿。每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取。拿到最后1颗石子的人获胜。假设A B都非常聪明,拿石子的过程中不会出现失误。给出2堆石子的数量,问最后谁能赢得比赛。 例如:2堆石子分别为3颗和5颗。那么不论A怎样拿,B都有对应的方法拿到最后1颗。 Input 第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <=原创 2016-07-31 19:34:00 · 1910 阅读 · 4 评论 -
HDU 5351 MZL's Border(大数 + 找规律)——2015 Multi-University Training Contest 5
传送门 MZL’s BorderTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1374 Accepted Submission(s): 452Problem Description As is known to all, MZL i原创 2016-08-26 14:33:02 · 1023 阅读 · 0 评论 -
51NOD 1836 战忽局的手段(矩阵乘法加速+__float128精度问题+概率期望)——算法马拉松20(告别美国大选及卡斯特罗)
传送门题目描述:众所周知,有一个神秘的组织——战忽局,在暗中保护着我们。在局中任职的官员都有着极强的忽悠技巧,不只能用预言,还能用往事忽悠人。如今某外星间谍已经获得了战忽局曾经参与的n次事件的资料,局座发现了这件事,于是决定再次用忽悠来保证战忽局的安全。局座将发表m次演讲,每一天他都会从n事件中等概率地挑选一件混淆众人,由于局座每天很忙,不能把之前将的事件都记录下来,因此他可能会重复选择某一件事。现原创 2016-12-03 19:09:38 · 2304 阅读 · 0 评论