Pagini recente » Cod sursa (job #2540500) | Borderou de evaluare (job #2360983) | Cod sursa (job #3186523) | Cod sursa (job #2951800) | Cod sursa (job #1494599)
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxN 402
using namespace std;
int n, m, i, j;
long long sol;
void read()
{
freopen("dreptunghiuri.in", "r", stdin);
scanf("%d %d", &n, &m);
sol = (n * (n - 1) *1LL) / 2;
if (m % 2)
{
sol *= (m - 1) / 2 * 1LL;
sol *= m * 1LL;
}else
{
sol *= m / 2 * 1LL;
sol *= (m - 1) * 1LL;
}
}
void solve()
{
int l, c;
for (i = 1; i <= n; ++ i)
for (j = 1; j <= m; ++ j)
{
l = min(n - i, i - 1);
c = min(m - j, j - 1);
sol += l * c * 1LL;
}
}
void write()
{
freopen("dreptunghiuri.out", "w", stdout);
printf("%lld", sol);
}
int main()
{
read();
solve();
write();
return 0;
}