artemgf

Телефонные тарифы

Mar 18th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <math.h>
  4. #include <string>
  5. #include <algorithm>
  6. #include <set>
  7.  
  8. using namespace ::std;
  9.  
  10. int main()
  11. {
  12.     int basicN, basicC, combN, combT, combC, unlimN, N, combprom;
  13.     int ss,mm, Time=0, j = 1;
  14.  
  15.     cin >> basicN >> basicC;
  16.     cin >> combN >> combT >> combC;
  17.     cin >> unlimN;
  18.     cin >> N;
  19.  
  20.     for (int i = 1; i <= N; i++)
  21.     {
  22.         scanf_s("%d:%d", &mm, &ss);
  23.         if (mm != 0)
  24.         {
  25.             if (ss != 0)
  26.                 Time = Time + mm + 1;
  27.             else
  28.                 Time = Time + mm;
  29.         }
  30.         else
  31.             if (ss > 6 && mm == 0)
  32.                 Time = Time + 1;
  33.     }
  34.  
  35.     combprom = Time - combT;
  36.     if (combprom < 0)
  37.         combprom = 0;
  38.  
  39.     cout << "Basic:     " << basicN + Time*basicC << endl;
  40.     cout << "Combined:  " << combN + combC*combprom << endl;
  41.     cout << "Unlimited: " << unlimN;
  42.  
  43.     _getch();
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment