Codeforces 714B. Filya and Homework】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/714/B 题意: 给你一个含有 n 个数的数组, 问你是否存在一个 x, 使得这个数组中的某些数加上 x, 某些数减去 x 后所有数都相等. 思路: 如果这个数组里面不相等的数大于 3 个那么 x 就不可能存在. 否则如果这个数组里仅有三个数不一样且设为 a, b, c(a < b < c), 则还必须满足 b - a == c - b. 使得所有等于 a 的数加上 b - a 变为 b, 所有等于…
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…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your hel…
题目链接: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 即可满足条…
http://codeforces.com/contest/714/problem/B 给定一个序列,对于每一个元素,只能 + 或者 - 一个数val.这个数一旦选定,就不能改. 问能否变成全部数字都一样. 一开始还以为没 + 一次,就要 - 一次. 结果不是,一直wa 那么这样的话,这题的正解是观察法.也可以证明. ①.全部数字都一样.有两个不同数字.三个不同数字(a[1] + a[3] =  2 * a[2])这些都易懂 那4个不同数字为什么是no呢 可以想象成找不到一个点,作为圆心,包含另…
BUPT 2017 summer training (for 16) #1G 题意 每个人有一个懒惰值,每个任务有个难度,一开始每个人的任务和懒惰值都为\(a_i\),完成任务时间是懒惰值乘以难度,现在重新分配任务,问花费的时间最小是多少.结果模10007. 题解 显而易见,最好的分配方法是最懒的人做最简单的任务...然后就排序求和. 注意用long long. 代码 #include <cstdio> #include <algorithm> #define ll long lo…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Fr…
Codeforces Round #371 (Div. 2) A. Meeting of Old Friends |B. Filya and Homework A. Meeting of Old Friends  模拟 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; typedef long long ll;…
B. Filya and Homework time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to com…
A. Meeting of Old Friends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sony…
Filya and Homework 题意: 给定一串数字,任选一个数a,把若干个数加上a,把若干个数减去a,能否使得数列全部相同: 思路: 我开始就想找出平均数,以为只有和偶数的可以,结果wa在 1, 3这样的数据上: 后来才知道是要考虑等差数列的判定(还只用考虑3个的情况),下面还学到了大佬的骚操作: 正确解法:如果这个数组里面不相等的数大于 3 个那么 x 就不可能存在. 否则如果这个数组里仅有三个数不一样且设为 a, b, c(a < b < c), 则还必须满足 b - a == c…
A - A codeforces 714A Description Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sonya is an owl and she sleeps during the day and stay awake from minute l1 to minute r1 inclusive. Also,…
## Problem A A - Meeting of Old Friends CodeForces - 714A 题意: 解题说明:此题其实是求两段区间的交集,注意要去除掉交集中的某个点. 题解: C++版本一 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<string> #include<cmath> int m…
题目链接: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…
[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…
     好题啊,被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…
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/437/A 题目意思:给出四个选项A.B.C.D选项的内容描述,要求选出符合以下条件的一项. (1)如果某个选项描述(排除前缀X.)的长度至少两倍短于其他选项,即 2*某个选项的长度 <= 其他选项的长度: 或者某个选项的长度至少两倍长于其他选项,即 其他选项的长度 <= 2*某个选项的长度,那么就认为该选项是great的. (2)如果只有一个great 的选项,就输出该选项(A or B or C o…
注意题目长度不能考虑前缀,而且如果即存在一个选项的长度的两倍小于其他所有选项的长度,也存在一个选项的长度大于其他选项长度的两倍,则答案不是一个好的选择,只能选择C. #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; struct Answer{ char item; int length; Answer():ite…
codeforces 459E E. Pashmak and Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he…
LINK time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In…
Unusual Product Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix. T…
链接:http://codeforces.com/contest/437/problem/A 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 time a child got a test consisting of multiple-choice qu…
D. The table 题目连接: http://www.codeforces.com/contest/226/problem/D Description Harry Potter has a difficult homework. Given a rectangular table, consisting of n × m cells. Each cell of the table contains the integer. Harry knows how to use two spells…
B. Anton and Lines Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/problem/B Description The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforc…
Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)n…
A. Meeting of Old Friends time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sony…
A. Combination Lock time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there…
A. Vanya and Table   Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. In this table, Vanya chose n re…
D. Anton and School - 2 题目连接: http://codeforces.com/contest/785/problem/D Description As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn differ…