Codeforces 328A-IQ Test(数列)】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/328/A 一开始单纯地直接判断给出的序列是等差还是等比,连这一句“You should also print 42 if the next element of progression is not integer ”  都直接忽略,因为 Output 中没说,只是描述里讲了(要积累经验啊!!),其实是大错特错! 这个题目的关键是,当判断出给定的序列是等比时,求出下一个数(假设为result)是否是小数…
[Codeforces 316E3]Summer Homework(线段树+斐波那契数列) 顺便安利一下这个博客,给了我很大启发(https://gaisaiyuno.github.io/) 题面 有一个数列\(f_i\)满足\(f_0=f_1=1,f_i=f_{i-1}+f_{i-2}(i>2)\)(就是斐波那契数列) 给定一个n个数的数列a,m个操作,有3种操作 1.将\(a_x\)的值修改成v (单点修改) 2.对于\(i \in [l,r],a_i+=v\) (区间修改) 3.求\(\s…
Codeforces 题目传送门 & 洛谷题目传送门 你可能会疑惑我为什么要写 *2400 的题的题解 首先一个很明显的想法是,看到斐波那契数列和 \(10^9+9\) 就想到通项公式,\(F_i=\dfrac{1}{\sqrt{5}}((\dfrac{1+\sqrt{5}}{2})^n-(\dfrac{1-\sqrt{5}}{2})^n)\).并且 \(5\) 在模 \(10^9+9\) 意义下的二次剩余存在,为 \(383008016\). 我们建两棵线段树分别维护展开式中 \((\dfra…
C. DZY Loves Fibonacci Numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1 = 1; F2 …
A. IQ Test time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. N…
题目:Click here 题意:给定数列满足求f(n)mod(1e9+7). 分析:规律题,找规律,特别注意负数取mod. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; ; ; int x, y, n; ]; int main() { while( ~scanf…
题目链接:http://www.codeforces.com/problemset/problem/25/A题意:在n个书中找到唯一一个奇偶性和其他n-1个数不同的数.C++代码: #include <iostream> using namespace std; ; , y = -; int main() { cin >> n; ; i <= n; i ++) { cin >> a; == ) x = (x == -) ? i : -; else y = (y =…
http://codeforces.com/contest/353/problem/C Codeforces Round #205 (Div. 2)C #include<stdio.h> ]; ]; ]; int Max(int a,int b){ if(a<b)return b; else return a; } int main(){ int n; while(scanf("%d",&n)!=EOF){ int i; dp[]=; ;i<=n;i++…
IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from t…
A. IQ test time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the givenn numbers differs from…