Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- long long a, b, c;
- cin >> a >> b >> c;
- set <long long> ans;
- long long count_cube_first, count_cube_second;
- for (count_cube_first = 0; count_cube_first <= n; count_cube_first++) {
- for (count_cube_second = n - count_cube_first; count_cube_second <= n; count_cube_second++) {
- long long height = count_cube_first * a + count_cube_second * b + (n - count_cube_first - count_cube_second) * c;
- ans.insert(height);
- }
- }
- cout << ans.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment