Squares 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 the…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,20 ms) #include<iostream> #include<cstring> using namespace std; int N, M, x, y, CO[12], Times = 0;// 2 <=n<= 9,CO=Count char SQ[12][12], ch; inline bool V(char a) { return (a == 'B'…
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n = 13 Output: 2 Explanation: 13 = 4 + 9.---…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 注意那个星号的数量... 然后V x y的话,是从(y,x)向(y+1,x)连线. H x y才是从(x,y)向(x,y+1)连线 枚举以(x,y)作为左上角的举行就ok了 [代码] #include <bits/stdc++.h> using namespace std; const int N = 10; int n,m; bool a[N+10][N+10][2]; int cnt[N+5]; bool check(in…