CodeForces 450B Jzzhu and Sequences (矩阵优化) Description Jzzhu has invented a kind of sequences, they meet the following property: \[f_1=x\] \[f_2=y\] \[f_i=f_{i-1}+f_{i+1}\text {(i>2)}\] You are given x and y, please calculate fn modulo 1000000007 (10…
题目链接:https://vjudge.net/problem/CodeForces-450B B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Jzzhu has invented a kind of sequences, they meet the following proper…
Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 1000000007 (109 + 7). Input The first line contains two integers x and y (|x|, |y| ≤ 109). The second line contains a single i…
题目链接:http://codeforces.com/contest/450/problem/C 题目意思:给出一个 n * m 大小的chocolate bar,你需要在这个bar上切 k 刀,使得最小的部分面积尽可能大,求出这个被划分后的最小部分面积最大可以为多少.如果这个chocolate bar 不能切成 k 部分,则输出-1.注意,每一刀需要符合3个条件:1.打横切或者打竖切: 2.每一刀只能经过unit square(即1*1的单元bar)的边,也就是说不能把一个单元bar损坏,要完…
矩阵快速幂. 首先得到公式 然后构造矩阵,用矩阵加速 取模函数需要自己写一下,是数论中的取模. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<algorithm> using namespace std; ; long long x, y; int n; long long mod(long long a, long long b) { )…