[题目链接] http://codeforces.com/problemset/problem/610/C [题目大意] 构造出2^n个由1和-1组成的串使得其两两点积为0 [题解] 我们可以构造这样一个矩阵,右下角四分之一和其余三个分块相反, 不断扩展这个矩阵即可. [代码] #include <cstdio> #define rep(i,n) for(int i=1;i<=n;i++) using namespace std; const int N=1000; int k,p[N]…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look li…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a set Y of n distinct positive integers y1, y2, -, yn. Set X of n distinct positive integers x1, x2, -, xn is said to generate set…
题目链接 可以发现 十进制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 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 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…
[链接] 我是链接,点我呀:) [题意] [题解] 如果|x|+|y|>n 显然.从(0,0)根本就没法到(x,y) 但|x|+|y|<=n还不一定就能到达(x,y) 注意到,你每走一步路 |x|+|y|的奇偶性会发改变奇变偶,偶变奇. 因此,如果|x|+|y|的奇偶性和n不一样的话. 显然也是没法走到(x,y)的 可以这么理解,先走|x|+|y|步到达(x,y) 然后n-(|x|+|y|)显然是一个偶数(奇偶性一样的话,相减为偶数) 因此,它肯定又能走回来. ----------------…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first divisio…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until m…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first divisio…