fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. long long N, K, L;
  7. cin >> N >> K >> L;
  8.  
  9. // Calculate the total area of all squares
  10. long long totalArea = N * L * K;
  11.  
  12. // Calculate the area of overlap (the area of the last square that doesn't overlap)
  13. long long overlapArea = (N - 1) * L * K;
  14.  
  15. // Calculate the area of the union
  16. long long unionArea = totalArea - overlapArea;
  17.  
  18. cout << unionArea << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5280KB
stdin
4 1 2
stdout
2