CodeForces - 316E3 Summer Homework】的更多相关文章

[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…
Discription By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher: You are given a sequence of integers a1, a2, ..., an. Your task is to perform on it mconsecutive operations of the f…
题目链接:http://codeforces.com/problemset/problem/316/E3 题意:一个数列A三种操作:(1)1 x y将x位置的数字修改为y:(2)2 x y求[x,y]区间的数字的和,和函数为如下:(3)3 x y z将[x,y]区间的数字统一加z. 思路:很明显,这是一个线段树的题目.其中第一种和第三种操作都很容易搞定,第一种直接更新到底:第三种增加标记.显然为了求和,我们必须要在节点上增加一个和,表示以这个节点为根的子树的数字的和函数,这里我们用a来表示.那么…
最关键的一点就是 f[ 0 ] * a[ 0 ] + f[ 1 ] * a[ 1 ] + ... + f[ n - 1] * a[ n  - 1] f[ 1 ] * a[ 0 ] + f[ 2 ] * a[ 1 ] + ... + f[ n ] * a[ n  - 1] f[ 2 ] * a[ 0 ] + f[ 3 ] * a[ 1 ] + ... + f[ n + 1] * a[ n  - 1] ...... 这也是满足斐波那切的性质 也就是说,系数的斐波那切的多项式也能向斐波那切一样递推.…
\(CodeForces 706E ~Working routine\) 给出一个矩阵,每次操作交换两个子矩阵,求最后状态. 使用链表存储,每次交换后,影响到的之后矩阵边缘的指针,暴力修改. \(~~~~\) \(CodeForces 985E ~Pencils and Boxes\) 每个铅笔盒至少放\(k\)个铅笔,每个盒子中的铅笔价值的绝对值之差不能超过\(d\).求是否有方案. 放在一个盒子里的铅笔价值是连续的一段,这样一定不劣.使用线段树维护合法的权值起始位置. \(~~~~\) \(…
Summer Homework CodeForces - 316E3 By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher: You are given a sequence of integers a1, a2, ..., an. Your task is to perform on it mconsecut…
题目链接:Codeforces 437A The Child and Homework 少看了一个条件,最后被HACK掉到203名,要不然就冲到100多一点了==.. 做这个题收获最大的是英语,A twice longer than B 表示 A >= 2 * B,A twice shorter than B表示 A * 2 <= B. #include <iostream> #include <cstring> #include <cstdio> #inc…
B. Filya and Homework 题目连接: http://codeforces.com/contest/714/problem/B Description Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help. Filya is given an arra…
题目链接:http://codeforces.com/problemset/problem/714/B 题目大意: 第一行输入一个n,第二行输入n个数,求是否能找出一个数x,使得n个数中的部分数加上x或部分数减去x ,n个数相等. 例如:5 1 3 3 2 1 输出: YES Init: x=1 情况,第一个数和最后一个数+x,第二三个数减去x ,则这n个数都为2(相等),故输出“YES” 解题思路: 对于刚才举的例子 可知 n个数只有三个元素 1 2 3 只要使得 2-1==3-2 即可满足条…
     好题啊,被HACK了.曾经做题都是人数越来越多.这次比赛 PASS人数 从2000直掉 1000人  被HACK  1000多人! ! ! ! 没见过的科技啊 1 2 4 8 这组数 被黑的 A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once upon a ti…