Ser1ousSAM

Пропавшие слитки

Oct 6th, 2020
54
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4. int main() {
  5.     int n;
  6.     cin >> n;
  7.     long long a, b, c;
  8.     cin >> a >> b >> c;
  9.     set <long long> ans;
  10.     long long count_cube_first, count_cube_second;
  11.     for (count_cube_first = 0; count_cube_first <= n; count_cube_first++) {
  12.         for (count_cube_second = n - count_cube_first; count_cube_second <= n; count_cube_second++) {
  13.             long long height = count_cube_first * a + count_cube_second * b + (n - count_cube_first - count_cube_second) * c;
  14.             ans.insert(height);
  15.         }
  16.     }
  17.     cout << ans.size();
  18.     return 0;
  19. }
RAW Paste Data