Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Muf Podnapisi C++ 100/100OK 10. maj '18 @ 19:27

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 3,223 MiB 0,000 s OK
#2 7/7 3,223 MiB 0,000 s OK
#3 7/7 3,285 MiB 0,000 s OK
#4 7/7 3,293 MiB 0,000 s OK
#5 7/7 3,281 MiB 0,003 s OK
#6 7/7 3,223 MiB 0,000 s OK
#7 7/7 3,223 MiB 0,004 s OK
#8 7/7 3,293 MiB 0,000 s OK
#9 7/7 3,223 MiB 0,000 s OK
#10 7/7 3,223 MiB 0,000 s OK
#11 7/7 3,223 MiB 0,003 s OK
#12 7/7 3,293 MiB 0,000 s OK
#13 8/8 3,293 MiB 0,000 s OK
#14 8/8 3,219 MiB 0,003 s OK

Ocenjevani program (podnapisi.cpp):
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    int H, M, S, U;
    scanf("SHIFT: %d:%d:%d,%d\n", &H, &M, &S, &U);
    string i;
    cin >> i;
    while (true) {
        // scanf("%d\n", &i);
        int H1, M1, S1, U1;
        int H2, M2, S2, U2;
        scanf("%d:%d:%d,%d --> %d:%d:%d,%d\n",
              &H1, &M1, &S1, &U1,
              &H2, &M2, &S2, &U2);

        cout << i << endl;
        U1 += U;
        U2 += U;
        S1 += S;
        S2 += S;
        M1 += M;
        M2 += M;
        H1 += H;
        H2 += H;
        if (U1 > 999) {
            U1 -= 1000;
            S1 += 1;
        }
        if (U2 > 999) {
            U2 -= 1000;
            S2 += 1;
        }
        if (S1 > 59) {
            S1 -= 60;
            M1 += 1;
        }
        if (S2 > 59) {
            S2 -= 60;
            M2 += 1;
        }
        if (M1 > 59) {
            M1 -= 60;
            H1 += 1;
        }
        if (M2 > 59) {
            M2 -= 60;
            H2 += 1;
        }
        printf("%.2i:%.2i:%.2i,%.3i --> %.2i:%.2i:%.2i,%.3i\n",
              H1, M1, S1, U1,
              H2, M2, S2, U2);
        bool end = false;
        while (true) {
            string line;
            getline(cin, line);
            // cerr << to_string(stoi(line)) << endl;
            // try{
            // if (to_string(stoi(line)) == line) {
            //     i = stoi(line);
            //     break;
            // }
            // }catch(...){}
            if (cin.eof()) break;
            bool b = true; // all letters are digits
            for (auto el:line) {
                if ((el < '0' or el > '9') and el != ' ') {
                    b = false; // if any not a digit fails test
                }
            }
            if (line == "") {
                end = true;
                continue;
            }
            if (end and b and !line.empty()) {
                i = line;
                break;
            }
            cout << line << endl;
        }
        if (cin.eof()) break;
        cout << endl;
    }
    return 0;
}