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…
题目链接 可以发现 十进制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 test1 second memory limit per test256 megabytes inputstandard input outputstandard output After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycles of an odd length in w…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. In total there are n piles of…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic num…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a graph - somet…
题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11674&courseid=0 题目大意: N个学生M道题(1<=N<=12,1<=M<=30),每道题只有正误两种选项(0 1),每个学生的答题情况和正确题数已知,求标准答案可能有多少种. 如果标准答案只有一种则输出标准答案,否则输出解的个数. 题目思路: […
[题目链接]: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号节点之前被访问过,所以不合法) 这就不是合法的; [题解] 每次走完之后都有一个接下来能…
[题目链接]:http://codeforces.com/contest/799/problem/D [题意] 给你长方形的两条边h,w; 你每次可以从n个数字中选出一个数字x; 然后把h或w乘上x; 直到能够把一个长为a宽为b的长方形装下为止; 问你最小的数字选择次数; [题解] 把所给的n个数字从大到小排; 显然同样是选一个数字,选大的数字肯定比较优; 问题只是要让哪一条边乘上它; 这里可以知道 如果全都是2的话 最多需要34个数字; 因为log2(100000)≈17 然后两条边都最多需要…