题意: 项的自幂级数求和为 11 + 22 + 33 + - + 1010 = 10405071317. 求如下一千项的自幂级数求和的最后10位数字:11 + 22 + 33 + - + 10001000. 思路: 求最后十位数字 % 1010 即可. 对于快速幂中数据溢出的问题,有两种解决方法: 1. 方法一:对于两个数 x y,现在想求 x * y % MOD,可以将 x 表示成 a * DIGS + b,y 表示成 c * DIGS + d,x * y % MOD 则等价与 ( a * c…
题目链接 求 $ 1^1+2^2+\cdots + 1000^{1000} $ %1e10 的结果. 唯一的坑点是会爆longlong, 所以用特殊的乘法. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include <complex> #include <cmath> #i…
题意:给出一个大数,这个大数由两个素数相乘得到,让我们判断是否其中一个素数比L要小,如果两个都小,输出较小的那个. 分析:大数求余的方法:针对题目中的样例,143 11,我们可以这样算,1 % 11 = 1:      1×10 + 4 % 11 = 3:      3×10 + 3 % 11 = 0;我们可以把大数拆成小数去计算,同余膜定理保证了这个算法的这正确性,而且我们将进制进行一定的扩大也是正确的. 注意:素数打标需要优化,否则超时.   进制需要适当,100和1000都可以,10进制超…
题目链接:http://poj.org/problem?id=2635 题目分析: http://blog.csdn.net/lyy289065406/article/details/6648530…
Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c. Input Input starts with an integer T…
题意: 考虑所有满足2 ≤ a ≤ 5和2 ≤ b ≤ 5的整数组合生成的幂ab: 22=4, 23=8, 24=16, 25=3232=9, 33=27, 34=81, 35=24342=16, 43=64, 44=256, 45=102452=25, 53=125, 54=625, 55=3125 如果把这些幂按照大小排列并去重,我们得到以下由15个不同的项组成的序列: 4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 31…
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c. Input Input starts with an integer T (≤ 525), denot…
    Search…
Problem Descripton Two planets named Haha and Xixi in the universe and they were created with the universe beginning. There is 73 days in Xixi a year and 137 days in Haha a year. Now you know the days N after Big Bang, you need to answer whether it i…
Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5930    Accepted Submission(s): 4146 Problem Description As we know, Big Number is always troublesome. But it's really important in our…