Codeforces 758B:Blown Garland(模拟)】的更多相关文章

题目链接:http://codeforces.com/contest/758/problem/B 题意:一个原先为4色环的链子少了部分,要你找出死的最少的一种可能,各输出四种颜色的死了多少. 分析:就是要找出这个链子是那个部分.那么就有4!种可能. #include <bits/stdc++.h> using namespace std; ][] = { "BGRY", "BGYR", "BRGY", "BRYG"…
B. Blown Garland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.…
B. Blown Garland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.…
http://codeforces.com/problemset/problem/758/B 题意:给出一个字符串,每4个位置对应一个颜色,如果为‘!’的话,代表该灯泡是坏的,问最后每个颜色坏的灯泡的数目. 思路:题意实在挺难懂的(可能我到现在还没看懂).看样例看了好久才看出来.例如最后一个样例“!GB!RG!Y!”:可以拆分成"!GB!”,"RG!Y","!",R只在第一个位置出现,说明R是在第一个位置的,以此类推,G是在第二个位置,B是在第三个位置,Y…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland. Now he has a goal to…
题意:输入是由连续的RYGB和字符!组成的字符串,R代表红灯,Y代表黄灯,G代表绿灯,B代表蓝灯.简而言之,就是给定的字符串保证了下标对4取余相同的灯颜色都相同,但是有的地方为‘!’代表这个灯坏了,然后分别输出坏了的红.蓝.黄.绿灯的数量. 分析:因为下标对4取余相同的灯颜色都相同,所以确定了前四个灯的颜色,后面的灯都是前四个灯颜色的不断循环,两个map映射一下就可以了. #include<bits/stdc++.h> #define Min(a, b) ((a < b) ? a : b…
D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard input output: standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships…
A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U'…
题目链接:http://codeforces.com/problemset/problem/589/D 题目大意:给出n个人行走的开始时刻,开始时间和结束时间,求每个人分别能跟多少人相遇打招呼(每两人只能打招呼一次). 例: 输入:31 1 105 8 29 9 10 输出: 2 1 1 解题思路:先按行走的开始时刻排下序,然后直接模拟判断和比他后出现的人是否可以相遇. 第一步判断前面那个人在未走完前,下一人会出现,若不出现,直接break.然后就计算当下一个人出现的时刻,前一个人的位置,然后又…
题目链接:http://codeforces.com/problemset/problem/1108/D time limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard output You have a garland consisting of n lamps. Each lamp is colored red, green or blue. The colo…