Codeforces Round #350 (Div. 2) A】的更多相关文章

题目链接: http://codeforces.com/contest/670/problem/E 题解: 用STL的list和stack模拟的,没想到跑的还挺快. 代码: #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<list> #include<stack> using namespace std; + ; const in…
题目链接: http://codeforces.com/contest/670/problem/D2 题解: 二分答案. #include<iostream> #include<cstdio> #include<cstring> #include<map> using namespace std; + ; const int INF = 2e9; typedef __int64 LL; int n, k; int x[maxn], y[maxn]; bool…
题目链接:http://codeforces.com/contest/670/problem/E 给你n长度的括号字符,m个操作,光标初始位置是p,'D'操作表示删除当前光标所在的字符对应的括号字符以内的所有字符(比如'(()())'),'R'操作表示右移光标,'L'操作表示左移光标.删除操作后光标向右移,要是再向右移没有字符的话,那就停在最后的字符上了.问你最后的括号字符是怎么样的. 这题用链表写简单多了,直接模拟操作就行了,我用stl里的list. #include <bits/stdc++…
codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days…
E. Correct Bracket Sequence Editor 题目连接: http://www.codeforces.com/contest/670/problem/E Description Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). Note that a bracket sequence…
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single soluti…
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For conveni…
B. Game of Robots 题目连接: http://www.codeforces.com/contest/670/problem/B Description In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier - an integer from 1 to 109. At some moment, robots dec…
A. Holidays 题目连接: http://www.codeforces.com/contest/670/problem/A Description On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings - 5 work days and then 2 days off. Your tas…
给出一个合法的括号串 有LRD三种操作 LR分别是左右移动当前位置 且合法 D为删除这个括号和里面的所有 当删除完成后 位置向右移动 如果不能移动 就向左 比赛都是很久远的事情了 写这道题也是一时兴起 先写了一发暴力 先拿a记录下来与这个括号相匹配的括号位置 拿vis记录括号是否被删除 每次碰到false的括号就整体跳过 然后一气跑到了test78才停下来 想了想暴力肯定不行 就加了l数组和r数组 来记录当前位置的左右仍存在的括号在哪 每次进行移动和删除的时候都利用这个进行移动 顺便更改 有一种…
五一期间和然然打的团队赛..那时候用然然的号打一场掉一场...七出四..D1是个数据规模较小的题 写了一个暴力过了 面对数据如此大的D2无可奈何 现在回来看 一下子就知道解法了 二分就可以 二分能做多少个 每次对mid求一下不够的差值 比较差值与m的大小进行l与r的变换 由于自己一向对二分比较迷茫 自己琢磨出来一套神奇的办法面对边界数据 当小于和大于的时候 抛弃mid值 当等于的时候 直接break 然后打一发while试试能否向更好的情况偏移 当然在这个题目中 如果是直接break的时候就不用…
F. Restore a Number   Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
A. Holidays time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings …
D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all languages of the world with integers from 1 to 109. I…
D1. Magic Powder - 1 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraint…
C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scient…
B. Game of Robots time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an intege…
A. Holidays time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings …
E. Correct Bracket Sequence Editor   Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). Note that a bracket sequence is correct if it is possible to get a correct mathematical expre…
A. Holidays 题意:一个星球 五天工作,两天休息.给你一个1e6的数字n,问你最少和最多休息几天.思路:我居然写成模拟题QAQ. #include<bits/stdc++.h> using namespace std; //#define int long long signed main(){ int n; cin>>n; ==){ ;x*=; cout<<x<<" "<<x; ; } ; ; ; int temp…
因为当天的下午才看到所以没来得及请假所以这一场没有打...于是信息课就打了这场的模拟赛. A题: *题目描述: 火星上的一年有n天,问每年最少和最多有多少休息日(周六周天). *题解: 模7分类讨论一下. *代码: #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #ifdef WIN32 #define LL "%I64d" #else…
今天对着算法进阶指南,学了一下离散化.大概对桶排这样的算法优化比较好吧. 离散化:就是把无穷大的集合中若干个元素映射为有限集合以便于统计的方法.例如在很多时候,问题范围定义为整数集合Z,但涉及的元素只有m个.(桶排优化) 此时,我们就可以把这些整数与(1-m)建立起映射关系,再去掉重复的元素. 先排序,再删去相同的元素(也可以用unique函数) void discrete() { int m=0; sort(a+,a+n+); ;i<=n;i++)||a[i]!=a[i-]) b[++m]=a…
题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出来的,这题也蛮水的 模拟+贪心:sort一下,从最近的开始走 注意:坐标有一个为0的比普通的少一半的步骤,每次干掉一个要返回原来的位置 */ #include <cstdio> #include <iostream> #include <algorithm> #includ…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…