time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo…
题目链接 可以发现 十进制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> #…
Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly,…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art. The main…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In total the table A…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds:…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet a…
[题目链接]:http://codeforces.com/contest/515/problem/C [题意] 定义f(n)=n这个数各个位置上的数的阶乘的乘积; 给你a; 让你另外求一个不含0和1的最大的数字b; 使得f(a)==f(b) [题解] 对a的每一个大于1的数字进行分解; 看看它能够组合成的最多的比它小的数字的阶乘的乘积是哪些; 比如 4!=3!∗(2!)2 每个都找最多数目的:数目相同找大的数的组合; 求出2..9!的组合就好; 最后根据每个数字的分解方案; 求出所有的数字; 然…
[题目链接]:http://codeforces.com/contest/766/problem/E [题意] 定义树上任意两点之间的距离为这条简单路径上经过的点; 那些点上的权值的所有异或; 求任意两点之间的距离和; [题解] 权值最大为1e6 所以每个点的权值的二进制形式最多20位左右; 则我们可以对权值的二进制形式的每一位独立考虑; 我们枚举第i位; 并且在计算的时候只考虑这第i位; 可以做树形dp; 算出穿过当前这个节点的路径(并且以其为lca->最高点) 异或和的二进制形式在第i为上权…