http://codeforces.com/contest/761/problem/E 题意:给出一棵树,现在要把这棵树上的结点放置在笛卡尔坐标上,使得每一条边与x轴平行或者与y轴平行.输出可行解,即每个点放置的坐标. 思路: 一开始我想,这个每条边的边长都是可长可短的,好像很麻烦啊. 做法还是很巧妙的,因为最多也就30个点,所以我们直接让该点连接的边未len长度,然后dfs它的子节点并使它的子节点的边长为len/2.你会发现,这样线段就不会相交了. #include<iostream> #i…
E. Dasha and Puzzle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, bu…
http://codeforces.com/contest/761/problem/C 题意:给出n个串,每个串的初始光标都位于0(列)处,怎样移动光标能够在凑出密码(每个串的光标位置表示一个密码的字符,密码至少包含3种字符:数字,小写字母,特殊符号)的情况下使得移动的光标步数最小. 思路: 因为每个串只提供一个密码,所以我们先预处理计算出每个字符串3种字符的最少移动步数. 然后接下三重循环枚举,分别表示数字,小写字母,特殊符号由第i,j,k行提供. #include<iostream> #i…
http://codeforces.com/contest/761/problem/B 题意: 有一个长度为l的环形跑道,跑道上有n个障碍,现在有2个人,给出他们每过多少米碰到障碍,判断他们跑的是不是同一个跑道. 思路: 如果是同一个跑道,那么障碍与障碍之间的距离是相同的. 所以我们可以先计算出两个人的跑道的障碍之间的距离,然后暴力比较,如果全部一样就是同一个跑道(因为是环形跑道,所以在比较的时候每次都需要将第一个加到最后). #include<iostream> #include<st…
E. Dasha and Puzzle 题目连接: http://codeforces.com/contest/761/problem/E Description Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity - origami, but remembered the puzzle that she could not solve…
E. Dasha and Puzzle time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, bu…
C. Dasha and Password time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password i…
题目大意 两个人轮流在一个字符串上删掉一个字符,没有字符可删的人输掉游戏 删字符的规则如下: 1. 每次从一个字符串中选取一个字符,它是一个长度至少为 3 的奇回文串的中心 2. 删掉该字符,同时,他选择的那个字符串分成了两个独立的字符串 现在问,先手是否必胜,如果先手必胜,输出第一步应该删掉第几个字符,有多解的话,输出序号最小的那个 字符串的长度不超过5000,只包含小写英文字母 做法分析 可以这样考虑:将所有的长度大于等于 3(其实只需要找长度为 3 的就行)的奇回文串的中心标记出来 我们将…
Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 1000 mSec Problem Description Input Output Sample Input 51 2 1 2 1 Sample Output 1 1 1 2 2 题解:这个题有做慢了,这种题做慢了和没做出来区别不大... 读题的时候脑子里还意识到素数除了2都是奇数,读完之后就脑子里就只剩欧拉筛了,贪心地构造使得前缀和是连续的素数,那…
Codeforces Round #267 (Div. 2) C. George and Job题目链接请点击~ The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the follow…