time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Bogdan has a birthday today and mom gave him a tree consisting of n vertecies. For every edge of the tree i, some number xi was written on it. I…
题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制数字,求出其长len,当len为奇数时,第一位为1,后面的位数如果都为0,则输出len,如果有一个不为0,则输出len+1: 当len为偶数时,则输出len.(之所以这样输出是因为题目给定4的次幂是从0开始的) #include<iostream> #include<string> #…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are n vertices in the tree, e…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potio…
[题目链接]:http://codeforces.com/contest/793/problem/D [题意] 给你n个点, 这n个点 从左到右1..n依序排; 然后给你m条有向边; 然后让你从中选出k个点. 这k个点形成的一条路径; 且在路径中,一个被访问过的点不会经过两次或以上; 比如从1->3(1和3被访问过) 然后再从3->4(1,3,4都被访问过) 再从4->2(这时会又经过3号节点,而3号节点之前被访问过,所以不合法) 这就不是合法的; [题解] 每次走完之后都有一个接下来能…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard 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 consists of b consecu…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become a…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the len…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalen…