Cod sursa(job #3233522)
| Utilizator | Data | 3 iunie 2024 19:02:48 | |
|---|---|---|---|
| Problema | Dreptunghiuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
using namespace std;
// Funcție pentru a calcula combinațiile (n choose 2)
int comb(int n) {
return (n * (n - 1)) / 2;
}
int main() {
ifstream inFile("dreptunghiuri.in");
ofstream outFile("dreptunghiuri.out");
int m, n;
inFile >> m >> n;
int numHorizontalLines = m + 1;
int numVerticalLines = n + 1;
int totalRectangles = comb(numHorizontalLines) * comb(numVerticalLines);
outFile << totalRectangles << endl;
inFile.close();
outFile.close();
return 0;
}
