https://cn.vjudge.net/problem/UVA-1368 二维的hamming距离算法: For binary strings a and b the Hamming distance is equal to the number of ones (population count) in a XOR b. int hamming_distance(unsigned x, unsigned y) { ; unsigned val = x ^ y; // Count the n…
A children's board game consists of a square array of dots that contains lines connecting some of the pairs of adjacent dots. One part of the game requires that the players count the number of squares of certain sizes that are formed by these lines.…
https://cn.vjudge.net/problem/UVA-340 题目很难读,差不多读了两天 意思是给你一个n个数的数列,然后有m个询问,每个询问也是一个n个数的数列,让你输出两个数:一个是数相同且位置相同的数的总数,另一个是数相同但位置不同的总数.不过有一个蛋疼的约束: “Two matches (i, j) and (p, q) are called independent when i = p if and only if j = q. Two matches (i, j) an…
一开始用set存xjb分类讨论,然后wa, 然后简化了一点,改用vector,然wa 最后又发现没有初始化,然wa wa了一个半小时 最后看了题解orz 然后找了一组样例把自己的代码改对了 /* 1 11 11 11 11 21 2 */ 正统题解:不妨设三条边为a<=b<=c, 那么对每个面(边对)sort后,必然得到 ab ab ac ac bc bc 然后照着这个序列写六个判断就好了orz #define _CRT_SECURE_NO_WARNINGS #include<cmath…