CodeForces 450】的更多相关文章

题意:给出f1=x,f2=y,f(i)=f(i-1)+f(i+1),求f(n)模上10e9+7 因为 可以求出通项公式:f(i)=f(i-1)-f(i-2) 然后 f1=x; f2=y; f3=y-x; f4=-x; f5=-y; f6=-y+x; f7=x; 发现是以6为循环的 还有注意下余数为正,就每次加上一个mod再模上mod #include<iostream> #include<cstdio> #include<cstring> #include <cm…
A - Jzzhu and Children Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th…
//area=(n*m)/ ((x+1)*(k-x+1)) //1: x==0; //2: x=n-1 //3: x=m-1 # include <stdio.h> long long max(long long x,long long y) { return x>y? x:y; } int main() { long long n,m,k,sum,t,ans; scanf("%lld%lld%lld",&n,&m,&k); sum=n+m-2…
Codeforces Round #450 (Div. 2) http://codeforces.com/contest/900 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emplace_back #…
题目链接:http://codeforces.com/problemset/problem/450/B 题意: 求这个的第n项. 题解:$f_{i+1} = f_i - f_{i-1} $ \begin{pmatrix} 1 & 1\\ -1 & 0 \end{pmatrix} * \begin{pmatrix} f(n)& f(n-1) \end{pmatrix} = \begin{pmatrix} f(n) - f(n-1) & f(n) \end{pmatrix}=…
题目链接: http://codeforces.com/contest/900/problem/D 题意: 给你 \(x\) 和 \(y\),让你求同时满足这两个条件的序列的个数: \(a_1, a_2, ..., a_n (1 ≤ a_i)\). $ 1.$ $gcd(a_1, a_2, ..., a_n) = x $ $ 2.$ \(\sum_{i=1}^{n}a_i = y\) 题解: 可以发现,当\(y\%x!=0\)时,满足条件的序列不存在.让\(f(t)\)表示满足序列和为的 \(t…
题目链接 题意:让你去掉一个数,使得剩下的数的record最多,当1≤j<i的aj<ai1 \leq j< i的a_j<a_i1≤j<i的aj​<ai​时aia_iai​为recordrecordrecord数. 解法:遍历数组每个数,记录最大和次大值,用cntcntcnt数组记录,移除某个数后造成的recordrecordrecord数变化量.然后输出最优的即可. #include<bits/stdc++.h> #define LL long long #…
这次还是能看的0 0,没出现一题掉分情况. QAQ前两次掉分还被hack了0 0,两行清泪. A. Find Extra One   You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis. Inp…
C. Remove Extra One time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum…
B. Position in Fraction time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a fraction . You need to find the first occurrence of digit c into decimal notation of the fraction after de…