
大数
大数算法
贺贺学编程
微信搜一搜【贺贺学编程】关注这个不一样的程序员,关注后回复【面试】获取海量面试题。
-
原创 宿舍建群
假设两个人及以上便可创建一个QQ群,那么n个人的宿舍最多可能有几个不一样的QQ群呢?输入第一行有一个整数T,代表有T组数据。下面T行每行是一个整数n,代表这个宿舍有n个人。1<=T<=1051<=n<=109输出对于每一个结果可能很大,所以你只需要输出对1000000007取模的结果解题思路:组合数Cn0+Cn1+Cn2+...+Cnn=...2019-03-26 16:40:06856
0
-
原创 a^b mod p
数据范围:1<=a,b,p<=1e18#include<stdio.h>#include<string.h>long long F(long long m,long long n,long long N);int main(){ long long a,b,p,n,sum; while(scanf("%lld%lld%lld",&...2019-03-25 22:10:25998
0
-
原创 大数加法
#include<stdio.h>#include<string.h> int main(){ char str1[110],str2[110]; int a[110]; int i,j,k,t,len1,len2; while(scanf("%s%s",str1,str2)!=EOF) { len1=strlen(str1); len2=strl...2019-03-25 13:23:05749
0
-
原创 大数乘法
#include<stdio.h>#include<string.h>int main(){ char str1[110],str2[110]; int a[110],b[110],c[220],d[220]; int len1,len2,i,j,k,t; scanf("%s%s",str1,str2); len1=strlen(str1); len2=...2019-03-25 13:18:16815
0
-
原创 HDU-1753-大明A+B
大明A+BProblem Description话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。现在,给你两个正的小数A和B,你的任务是代表...2018-03-10 09:33:56797
0
-
转载 大数开方(大数)
#include <stdio.h>#include <string.h>#include <stdlib.h>#define DEPTH 10typedef int BigInteger[10100];int comp(const BigInteger a,const int c,const int d,const BigInteger...2019-04-30 13:51:181541
1