B. Making a String 题目连接: http://codeforces.com/contest/624/problem/B Description You are given an alphabet consisting of n letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied: the i-th…
C. Graph and String 题目连接: http://codeforces.com/contest/624/problem/C Description One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on hi…
C. Graph and String time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "…
D. Birthday 题目连接: http://www.codeforces.com/contest/623/problem/D Description A MIPT student named Misha has a birthday today, and he decided to celebrate it in his country house in suburban Moscow. n friends came by, and after a typical party they d…
D. Array GCD 题目连接: http://codeforces.com/contest/624/problem/D Description You are given array ai of length n. You may consecutively apply two operations to this array: remove some subsegment (continuous subsequence) of length m < n and pay for it m·…
A. Save Luke 题目连接: http://codeforces.com/contest/624/problem/A Description Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity…
这是我第一次完整地参加codeforces的比赛! 成绩 news standings中第50. 我觉这个成绩不太好.我前半小时就过了前三题,但后面的两题不难,却乱搞了1.5h都没有什么结果,然后在等System test的时候,就有点头绪了,囧.肯定是我在比赛的时候太困了(这是借口吗?). A Save Luke 考你会不会编程. B Making a String 贪心即可.这题是Hack最多的题.幸好我没有被. C Graph and String 注意到,如果某两个点之间没有边,说明其中…
B. Making a String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an alphabet consisting of n letters, your task is to make a string of the maximum possible length so that th…
A. Save Luke time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to…
C. Electric Charges 题目连接: http://www.codeforces.com/contest/623/problem/C Description Programmer Sasha is a student at MIPT (Moscow Institute of Physics and Technology) and he needs to make a laboratory work to pass his finals. A laboratory unit is a…
http://codeforces.com/contest/624 A.python是用来写div2的AB题的... a, b, x, y = map(float, raw_input().split()) print ((b - a) / (x + y)) B.思路很简单,但你的实现一样简短吗 n = input() a = sorted(map(int, raw_input().split())) s = 0 x = 10 ** 9 while a and x: x = min(x, a.p…
A. Save Luke 题意:给一个人的长度d,然后给一个区间长度0~L,给你两个子弹的速度v1,v2,两颗子弹从0和L向中间射去(其实不是子弹,是一种电影里面那种绞牙机之类的东西就是一个人被困在里面了,两边有着那种尖刺的墙向中间靠拢的那种)问Luke能存活的最长时间 思路:看代码吧,简单易懂 #include<cstdio> #include<cmath> int main() { int d,l,v1,v2; while(scanf("%d%d%d%d",…
2017-08-25 15:32:14 writer:pprp 题目: B. Rectangles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given n × m table. Each cell of the table is colored white or black. Find the numbe…
AIM Tech Round 5 (codeforces上题目编号是1028)(A-E) ---完全被这次比赛打击,自己真的很渣--- 战况 依旧3题选手 被构造题坑得好惨 稍稍涨了rating,希望下次比赛好好准备进入蓝名,就可以被div1虐了 题目看题解也很难懂呀 A. Find Square 水题,找出矩形得中心,可以略过 B. Unnatural Conditions 题意: s(A)代表数字A各个数位之和即s(1234)=1+2+3+4=10 给出 m,n,需要求出满足条件A,B:s(…
#include <iostream> using namespace std; ]; int main() { int n, b, d; cin >> n >> b >> d; ; i <= n; i++) { cin >> a[i]; } , tmp = ; ; i <= n; i++) { if (a[i] > b) { continue; } tmp += a[i]; if (tmp > d) { tmp = ;…
虽然打的时候是深夜但是状态比较好 但还是犯了好多错误..加分场愣是打成了降分场 ABC都比较水 一会敲完去看D 很快的就想出了求0和1个数的办法 然后一直wa在第四组..快结束的时候B因为低级错误被hack了...做完B想出了D的正解企图绝杀..然而还是失败了.. 想了想还是由于自己不够认真吧..手速做完前三题 看着能涨分的名次就不太努力的做D了..中间还水了一下群..浪费了很多时间 导致最后没有能够完成D A n个数 大于b被抛弃 不然就加入容器 如果容器中的和大于d 清理容器 直接模拟就好…
Description Vasya takes part in the orienteering competition. There are n checkpoints located along the line at coordinates x1, x2, ..., xn. Vasya starts at the point with coordinate a. His goal is to visit at least n - 1 checkpoint in order to finis…
Description Kolya is going to make fresh orange juice. He has n oranges of sizes a1, a2, ..., an. Kolya will put them in the juicer in the fixed order, starting with orange of size a1, then orange of size a2 and so on. To be put in the juicer the ora…
rating又掉下去了.好不容易蓝了.... A..没读懂题,wa了好几次,明天问队友补上... B. Checkpoints 题意:一条直线上n个点x1,x2...xn,现在在位置a,求要经过任意n-1个点的最小路程 题解:分类讨论,乱搞搞总会出来的,我大概写的很笨…… #include <bits/stdc++.h> using namespace std; typedef long long ll; ]; ll cal(ll x, ll a, ll z) { +(z-a) , (z-a)…
http://codeforces.com/contest/709 题目大意:给一个一维的坐标轴,上面有n个点,我们刚开始在位置a,问,从a点开始走,走n-1个点所需要的最小路程. 思路:我们知道,如果你一会儿走左一会儿左右,最后访问n-1个点一定只会让距离更长的,所以我们的策略是刚开始全都往一端走,然后访问完n-1个点即可.刚开始我是分类讨论的...讨论的要死了...不过后来看了一下别人的代码,发现虽然思路是对的,但是过程想麻烦了. 具体看代码吧. 我的乱七八糟的分类讨论 //看看会不会爆in…
D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For each string s consisting of characters '0' and '1' one can define four integers a00, a01, a10 and a11, where axy is…
A. Diversity time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters,…
A. Diversity time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters,…
模拟 首先可以求出 0 和 1 的个数 之后按照01 10 的个数贪心安排 细节太多 错的都要哭了 #include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d; while(~scanf("%d %d %d %d",&a,&b,&c,&d)) { int suc = 1; int t1,t2; t1 = sqrt(2*a); t2 = sqrt(2*d); t1 +…
·题目:D. Interactive LowerBound ·英文题,述大意:       有一个长度为n(n<=50000)的单链表,里面的元素是递增的.链表存储在一个数组里面,给出长度n.表头在数组的下标和一个值w.题目要求求出链表中大于等于w值的元素中的最小元素.注意,这道题是一道interactive.由于链表是未知的,最多可以进行1999个询问,询问形式:?i.表示询问数组下标为i,询问后,会得到一个答案组(val,Next),表示询问的元素是val,链表下一位所在的数组下标是Next…
·将排序限制于子序列中,又可以说明什么呢? C. Sorting by Subsequences ·英文题,述大意:       输入一个长度为n的无重复元素的序列{a1,a2……an}(1<=n<=105,|ai|<109,将其分成p个不重复的子序列,使得只对每个子序列升序排序,能够在各个子序列排完序后,整个序列也是升序排列好的.求p的最大值,将其输出后并按任意顺序每一行输出每个子序列长度和每个元素排序好的下标. ·分析:       对子序列排序,最终竟然可以使得整个序列都排好序,那…
B.Unnatural Conditions 题目链接 : http://codeforces.com/contest/1028/problem/B #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #define lson x<<1 #define rson (x<<1)|1 using namespace std; #define max…
A:显然最优方案是对所形成的置换的每个循环排个序. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> #include<vector> using namespace std; #define ll long long #define N 100010 cha…
题意:有一个01组成的串,告知所有长度为2的子序列中,即00,01,10,11,的个数a,b,c,d.输出一种可能的串. 先求串中0,1的数目x,y. 首先,如果00的个数a不是0的话,设串中有x个0,C(X,2)=a,那么x*(x+1)=2a,解方程(其实只要看sqrt(x)*(sqrt(x)+1)等不等于2a),x没有整数解就IMPOSSIBLE.同理得出1的个数y.如果00个数是0看01个数. 第二,如果x*y!=b+c则IMPOSSIBLE,具体自己举个例子就明白. 最后,先将所有的0组…
C - Upgrading Tree 我发现我构造题好弱啊啊啊. 很明显能想到先找到重心, 然后我们的目标就是把所有点接到重心的儿子上,让重心的儿子子树变成菊花图, 这个先把重心到儿子的边连到 i , 然后把 i 到 其 fa 的边连到重心的儿子上, 一直循环就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL p…