ZOJ 3774 二次剩余】的更多相关文章

LINK 题意:简单粗暴,求菲波那契数列每个数的m次的前n项和模1e9+7 思路:斐波那契通项式, 注意到有很多根号5,求二次剩余为5模1e9+7的解,显然我们可以直接找一个(383008016),然后拿来替代根号5,然后优化下,把中括号中共轭的两部分预处理下,然后由于是外部的一个指数m,从1枚举到m,来求二项式定理的每项系数,再用个逆元就好了.人家的校赛题( /** @Date : 2017-03-18-15.39 * @Author : Lweleth (SoungEarlf@gmail.c…
Power of Fibonacci Time Limit: 5 Seconds      Memory Limit: 65536 KB In mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, .…
In mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ... By definition, the first two numbers in the Fibonacci sequence are…
题目大意: 求斐波那契数列前n项的k次幂和  Mod 1000000009.    n<=1e18, k<=1e5 这题的k比较大,所以不能用矩阵乘法来递推.学到了新姿势...  http://blog.csdn.net/acdreamers/article/details/23039571 基本思想就是求出通项公式,把里面的$\sqrt{5}$   用 $x$ 代替, 其中 $x^2\equiv 5\pmod{1000000009}$ 然后二项式展开求和就好了. 一个合法的$x$是38300…
Poor Akagi Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 131    Accepted Submission(s): 29 Problem Description Akagi is not only good at basketball but also good at math. Recently, he got a…
原题:ZOJ 3774  http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3774 ---------------------------------------------------------------------------------------------------------------------- 这题比较复杂,看这篇比较详细:http://blog.csdn.net/acdreamers/artic…
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ  3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=3944 In a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that by having the waitre…
A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the labels are 0. We define this kind of operation: given a subtree, negate all its labels. An…
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求输入的格式: START X Y Z END 这算做一个data set,这样反复,直到遇到ENDINPUT.我们可以先吸纳一个字符串判断其是否为ENDINPUT,若不是进入,获得XYZ后,吸纳END,再进行输出结果 2.注意题目是一个圆周,所以始终用锐角进行计算,即z=360-z; 3.知识点的误…
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <stdio.h> #include <string.h> int main() { char cText[1000]; char start[10]; char end[5]; while(scanf("%s",start)!=EOF&&strcmp(start…