Advertisement
Semior001

317 acmp WA 1

Jun 27th, 2016
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int x,y,z,w;
  6.     // freopen("input.txt", "r", stdin);
  7.     // freopen("output.txt", "w", stdout);
  8.     // scanf("%d%d%d%d", &x,&y,&z,&w);
  9.     int count = 0;
  10.     int k_z;
  11.     cin >> x >> y >> z >> w;
  12.     for(int i = 0; i <= x; i++){
  13.         for(int j = 0; j <= y; j++){
  14.             k_z = w - i*x - j*y;
  15.             if(k_z%z==0 && k_z >= 0){
  16.                 // printf("%d %d %d\n", i, j, k_z);
  17.                 count++;
  18.             }
  19.         }
  20.     }
  21.     cout << count << endl;
  22.     // printf("%d\n", count);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement