ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1576. Telephone Tariffs

16 lines
Posted by D4nick 25 Sep 2020 17:04
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int N1, C1, N2, limit, C2, N3, n, time = 0, mins, secs, ans;
    cin >> N1 >> C1    >> N2 >> limit >> C2 >> N3 >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d:%d", &mins, &secs);
        ans = mins * 60 + secs;
        time += ans > 6 ? (ans + 59) / 60 : 0;
    }
    cout << "Basic:     " << N1 + time*C1 << '\n'
         << "Combined:  " << N2 + max(time - limit, 0) * C2 << '\n'
         << "Unlimited: " << N3;
}

Edited by author 25.09.2020 23:01