vlatkovski

Nova zgrada

Sep 8th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int k[5] = {};
  7.  
  8.     for (int i = 0; i < 5; i++) {
  9.         cin >> k[i];
  10.     }
  11.  
  12.     int s;
  13.     cin >> s;
  14.     s--;
  15.  
  16.     int zbir = 0, odzemeno = 0;
  17.  
  18.     for (int x = s - 1; x >= 0; x--) {
  19.         //cout << "x:" << x << " k[x]:" << k[x] << endl;
  20.         zbir += k[x];
  21.     }
  22.  
  23.     if (zbir >= 1 && zbir <= 5) {
  24.         odzemeno = 20;
  25.     } else if (zbir >= 6 && zbir <= 20) {
  26.         odzemeno = 40;
  27.     } else if (zbir > 20) {
  28.         odzemeno = 50;
  29.     }
  30.  
  31.     cout << 100 - odzemeno << endl;
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment