Pagini recente » Cod sursa (job #508237) | Cod sursa (job #1325816) | Cod sursa (job #1048902) | Cod sursa (job #69416) | Cod sursa (job #2456461)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("dreptunghiuri.in");
ofstream fout ("dreptunghiuri.out");
#define NMAX 403
int n, m, cnt;
long long ans;
int Rad [NMAX * NMAX];
int main (){
fin >> m >> n;
for (int i = 1; i <= NMAX; i ++)
Rad [i * i] = i;
for (int x = 1; x < n; x ++){
for (int y = 1; y < m; y ++) {
cnt = 1;
for (int A = 1; A < x; A ++) {
int delta = y * y - 4 * A * (x - A);
if (delta == 0 && y % 2 == 0)
cnt ++;
else if ((delta > 0 && Rad [delta] != 0) && (y + Rad [delta]) % 2 == 0 && y > Rad [delta])cnt += 2;
}
ans += (long long)cnt * (n - x) * (m - y);
}
}
fout << ans;
return 0;
}