Pagini recente » Cod sursa (job #3232059) | Cod sursa (job #2755622) | Cod sursa (job #344415) | Cod sursa (job #2772707) | Cod sursa (job #575510)
Cod sursa(job #575510)
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
#define pb push_back
#define sz size()
#define SORT(x) sort(x.begin(), x.end())
#define REVERSE(x) reverse(x.begin(), x.end())
#define REP(x, hi) for (int x=0; x<(hi); x++)
#define FOR(x, lo, hi) for (int x=(lo); x<(hi); x++)
#define FORALL(it,x) for (typeof(x.begin()) it=x.begin(); it!=x.end(); it++)
#define INFILE "dreptunghiuri.in"
#define OUTFILE "dreptunghiuri.out"
ifstream fin (INFILE);
ofstream fout (OUTFILE);
int n, m;
int main()
{
fin >> n >> m;
long long ans = 0;
n--;
m--;
FOR(i, 1, n+1)
FOR(j, 1, m+1)
if( i!=j )
ans += (n+1-i)*(m+1-j);
else
{
ans += (n+1-i)*(m+1-j) + i-1;
}
fout << ans << endl;
return 0;
}