Advertisement
vlatkovski

Posleden test

Oct 9th, 2017
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int k;
  5. double t1, t2, t3, t4;
  6.  
  7. void calc(int g1, int g2) { // [, )
  8.     int tos = t1+t2+t3+t4;
  9.     int t5min = 5*g1 - tos;
  10.     double pmin = (tos+t5min)/5;
  11.  
  12.     //cout << "t5min:" << t5min << " pmin:" << pmin << endl;
  13.     if (t5min <= 0) {
  14.         cout << 0;
  15.     }
  16.     else if (t5min > 100 || t5min < 0 || pmin < g1 || pmin >= g2) {
  17.         cout << "GRESHKA";
  18.     }
  19.     else {
  20.         cout << t5min;
  21.     }
  22. }
  23.  
  24. int main() {
  25.     cin >> k >> t1 >> t2 >> t3 >> t4;
  26.     if (k == 2) {
  27.         calc(60, 70);
  28.     }
  29.     else if (k == 3) {
  30.         calc(70, 80);
  31.     }
  32.     else if (k == 4) {
  33.         calc(80, 90);
  34.     }
  35.     else if (k == 5) {
  36.         calc(90, 100);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement