题意 给你n*n的图,让你数正方形 题解:暴力for每个点,对于每个点从它出发顺时针走一个正方形.走完就ans[i]++; 坑:多输了一行******,然后在那里手摸样例,无限debug orz #define _CRT_SECURE_NO_WARNINGS #include<cmath> #include<iostream> #include<stdio.h> #include<algorithm> #include<cstring> #inc…
题意:uva的题,每道都是有背景的orz,都是阅读理解 题解:暴力模拟,拿着短的那个串,对着长的一格一格往左滑,每滑一格暴力扫一遍.然后再从头往右滑,我这里wa了三发,wa了后习惯性瞎改,改到后来循环都改错了. shortest solution 用while循环ij当指针,还写了个函数处理左右滑. #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #inclu…
题意:阅读理解难度一道比一道难orz.手摸了好久样例 题解: 读入:大循环用getline读入header顺便处理一下,  里面再写两重循环,外层一次读三个串,内层一次读num个串. 之后就查表,线性输出即可. 关于判断11111,我用了换底公式:log(id + 1) / log(2) == num + 1 && pow(2, log(id + 1) / log(2)) 关于读入,我写了个getnchar的函数,封装一下getchar() 虽然是final模拟(签到orz)题,码量不大嘛…
https://cn.vjudge.net/problem/UVA-11809 题意:很长orz 题解:算一下输入范围,发现用double是读不进来的,在这里wa了半天,(double 1e300  longdouble 1e4000)这题会1e20201780 orz 所以分别读入mantissa a和 exponent b,然后取对数得到一个等式:log(a) + b*log(10)==log(m) + e * log(2),其中m,e是答案,因为范围很小,可以直接二重循环暴力找.打表可以优…
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.…
题解:给一个1e5个点2e5条边,每个边有一个值,让你输出一条从1到n边的路径使得:条数最短的前提下字典序最小. 题解:bfs一次找最短路(因为权值都是1,不用dijkstra),再bfs一次存一下路径,4个月前的代码(忘了为什么搞得那么麻烦),wa了两天,今天看了一下题目,看了一下代码,改了一下初始化数组,直接过了orz #define _CRT_SECURE_NO_WARNINGS #include<cstring> #include<cctype> #include<c…
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…
题意:背景就是象棋, 题解:坑点1(wa的第一天):将军可以吃掉相邻的棋子,(然行列也写反了orz) 坑点2(wa的第二天):将军到马要反过来写,边界有误,并且第一次碰到的车才算(写到后来都忘了) #define _CRT_SECURE_NO_WARNINGS #include<cmath> #include<iostream> #include<stdio.h> #include<algorithm> #include<cstring> usi…
一开始用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…