CodeForces B. Creating the Contest】的更多相关文章

http://codeforces.com/contest/1029/problem/B You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed that all difficulties are distinct and are given in the increasing order. You have to ass…
题目链接:http://codeforces.com/problemset/problem/1029/B 题目大意:从数组a中选出一些数组成数组b,要求 b[i+1]<=b[i]*2 . 一开始想到的是O(n^2)的动态规划,但是超时了,下面是超时的代码. #include <iostream> using namespace std; const int maxn = 200020; int n, a[maxn], f[maxn], res = 0; int main() { cin…
B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed t…
B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a problemset consisting of nn problems. The difficulty of the ii-th problem is aiai. It is guaranteed t…
C - Preparing for the Contest Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 377B Description Soon there will be held the world's largest programming contest, but the testing system sti…
题目链接:http://codeforces.com/problemset/problem/369/B 题目意思:给出6个整数, n, k, l, r, sall, sk ,需要找出一个满足下列条件的序列:1. l <= 每一个数 <= r   2.整个序列的数的和为sall       3.取得最高分数的那k个人的总分数恰好(注意,是刚刚好,多了或少了都不可,而且这k个人的分数不一定都是相等的)等于sk.(至于后面的那句 if a1, a2, ..... sk = a1 + a2 + ...…
140D - New Year Contest 思路:贪心+排序.罚时与时间成正比,因为在0点前做完的题都可以在0点提交.从时间短的开始做最优. 代码: #include<bits/stdc++.h> using namespace std; ; const int INF=0x3f3f3f3f; int a[N]; int main() { ios::sync_with_stdio(false); cin.tie(); int n; cin>>n; ;i<n;i++) {…
题目链接: B. Qualifying Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two…
咳咳,从今天开始,每天做一个英语题,不论简单还是难,坚持到下学期的省赛,希望能有效果. 这题就是判断是否能成为red,如果他超越的人里面有在比赛前分数达到2400,并且在比赛后分数上升,那么他就能成为red AC代码: #include<cstdio> #include<iostream> using namespace std; int main(){ string name; int pre,aft,n; scanf("%d",&n); int ok…
直接水过 #include<iostream> #include<algorithm> using namespace std; ; int a[maxn]; int n, u,maxx; int main(){ cin>>n; u=; ;i<n;++i)cin>>a[i]; ;i<n-;++i){ >=a[i+]){ ++u; } ; } } maxx=max(maxx, u); cout<<maxx<<endl;…
题目 传送门:QWQ A:Codehorses T-shirts 题意: 给定一些字符串表示去年和今年的衣服型号大小( XL XXL M...... ),要求用最少的次数把去年的衣服大小改成今年需要的.每次改动只能更改字符,不能增添字符. 分析: 把今年和去年的型号字典序排一下.然后用挨个对上(因为题目保证合法,所以长度一样的数量必定相等).在字符串长度是1的时候要暴力匹配一下,因为长度为1时有L S M三种东西. 代码: #include <bits/stdc++.h> using name…
题意:给定 n 个人和before, after的分数,让你找 before 的分数大于等于2400并且before 小于 after. 析:看完题意就知道怎么算了吧..不用说了 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; const int ans = 24…
第一次打ACM赛制的团队赛,感觉还行: 好吧主要是切水题: 开场先挑着做五道EASY,他们分给我D题,woc什么玩意,还泊松分布,我连题都读不懂好吗! 果断弃掉了,换了M和J,然后切掉了,看N题: loser大佬切了A,G: 然后翔哥在攻H题: N题好像是费用流,(看了一会才发现的我果断被同在机房打比赛的别的队的大佬D了233) 然后写出了之后,那个大佬说费用流T了,交都没交就弃掉了: (事后才知道大概是图建的不好) loser大佬B题写的差不多了,交上去WA... 翔哥在攻H题: 我开始看K题…
Description 给你一个单调不下降的长度为n的序列,请你找出一个最长的子序列,满足找出的子序列中,\(A_i<=A_{i-1}~\times~2\),其中i为下标,A为找出的子序列.对于一个长度为\(p\)的子序列,\(i~\in~[1,p-1]\). Input 两行,第一行是原序列的长度\(n\) 第二行是\(n\)个数,代表原序列中的\(n\)个数. Output 一行一个数,代表最长的长度 Sample Input 10 1 2 5 6 7 10 21 23 24 49 Samp…
题意: n<=2e5 思路:可以证明答案一定是极长的一段中取最大值 #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<algorithm> #include<map> #include<set> #include<queue> #include<v…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
Codeforces Round #506 (Div. 3) 题目总链接:https://codeforces.com/contest/1029 A. Many Equal Substrings 题意: 给出长度为n的字符串,然后要求你添加一些字符,使得有k个这样的字符串. 题解: 直接暴力吧...一个指针从1开始,另一个从2开始,逐一比较看是否相同:如果不同,第一个指针继续回到1,第二个指针从3开始...就这么一直重复.最后如果第二个指针能够顺利到最后一位,那么记录当前的第一个指针,把他后面的…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
C. Fly 链接:http://codeforces.com/group/1EzrFFyOc0/contest/1011/problem/C 题型:binary search .math. 题意:总共有n个星球,飞船从地球起飞经过n-2个星球(在每个星球上做降落.起飞的动作)到达火星,在火星上同样降落起飞,然后直接返回地球做降落.每个星球起飞所需的燃料质量为ai,降落所需要的燃料质量为bi.飞船本身载重为m,附加燃料质量为所求值.问至少需要多少质量的燃料使得地球能做完整的往返运动,精度为1e-…
链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1),然后重复循环这个数列,输入一个n,再输入有n个元素的某段,问你接下来是UP还是DOWN,若无法判断输出-1. 思路: 枚举各种情况,注意n==1…
Codeforces Round #486 (Div. 3) F. Rain and Umbrellas 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/E Description Polycarp lives on a coordinate line at the point x=0. He goes to his friend that lives at the point x=a. Polycarp can…
Codeforces Round #486 (Div. 3) E. Divisibility by 25 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/E Description You are given an integer n from 1 to 10^18 without leading zeroes. In one move you can swap any two adjacent digits in…
Codeforces Round #486 (Div. 3) D. Points and Powers of Two 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/D Description There are n distinct points on a coordinate line, the coordinate of i-th point equals to xi. Choose a subset of…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定n,a,b的值 求一个长度为n的由1和2组成的数列,要求数列中最多有a个连续的1和b个连续的2,问由多少种不同的数列 样例: 题目解法: 动态规划,使用一个二维数组,dp[i][1]代表当前位为1的前i个数的排列个数,dp[i][2]代表当前位为2的前i个数的排列个数 代码: #include <bits/stdc++.h> #…
题目链接:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定一个长度为2n,由n个大写字母和n小写字母组成的字符串,将对应的字母两两连接,且不相交,按顺序输出没个大写字母对应的小写字母的位置,如果不存在则输出"Impossible" 样例: 解法: 手动建立结构体,维护一个栈 代码: #include<bits/stdc++.h> using namespace st…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229511 时间限制:1s 空间限制:512MB 题目大意: 给定一个n 随后跟着2n行输入 "+ t":表示在t时刻获得了一样东西 "- t":表示在t时刻使用了一样东西 求每件东西等待时间的期望(得到的东西无先后顺序) 数据范围: 1 ≤ n ≤ 100 000 t ≤ 1e9 样例: 题目解法: 使用递推式从后往前推 代码: #include <al…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:1s 空间限制:512MB 题目大意: 给定一个字符串,使用%[...]形式将字符串中出现的字符整理到最短和最小(ASCII范围为32~126),可使用的字符有 '-' '^' 题目解法:模拟整理正的和使用 '^' 取反的两个字符串,输出较短较小的那个(注意当所有字符都存在时,输出%[^!]最小) 样例: 代码: #include <algorithm> #inclu…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 "max" "min" "+" "-" "" "/"对随机数 "?" 进行处理,使最后式子得到c的概率超过1/2 (所有数字均在0~255之间,"+" "…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个凸多边形,有一种连接两个顶点可以将多边形分成两个非空的面积为整数的图形,询问这种线有多少条. 数据范围: 4 ≤ n ≤ 200 000 −109 ≤ xi, yi ≤ 109 样例: 代码: #include <algorithm> #include <iostream> #include <cstr…