Question link: https://icpcarchive.ecs.baylor.edu/index.php? Option = com_onlinejudge & Itemid = 8 & page = show_problem & problem = 4613
Give you a matrix lattice of N * m. In the matrix lattice of N * m, you need to select four points to form a square, so that the square area is odd, ask how many such squares can be formed.
Question: Start from every odd number as a basic unit.
Area edge Square:
1*1 1 1
3*3 3 SQRT (5)1 + 1*2
5*5 5 SQRT (17) SQRT (13)1 + 2*2
7*7 7 SQRT (37) SQRT (29) SQRT (25) 1 + 3*2
......
A square with M * n can form a square with x (m-x + 1) * (N-x + 1 ).
# Include <iostream> # include <stdio. h >#include <cstring> using namespace STD; # define maxn 100005 # define ll long longll A [maxn]; int main () {ll M, N; while (~ Scanf ("% LLD", & M, & N) {If (M = 0 & n = 0) break; ll ans = 0; for (ll I = 1; I <= min (m, n); I + = 2) {ans + = (M-I + 1) * (N-I + 1) * (I/2*2 + 1);} printf ("% LLD \ n", ANS );}}