Rezultati

Up. imeNalogaJezikRezultatČas oddaje
ASMx64-2018 Podnapisi C++ 100/100OK 10. maj '18 @ 17:24

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

Ocenjevani program (main.cpp):
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int ho, m, s, u;

void changePart(unsigned int h, string &input) {
    int ost, st;
    st = stoi(input.substr(h-2,3)) + u;
    ost = st/1000;
    if (st >= 1000)
        st -= 1000;
    string num = to_string(st);
    while (num.length() != 3) {
        num = '0' + num;
    }
    for (unsigned int i = 0; i < 3; i++) {
        input[h-2+i] = num[i];
    }

    st = stoi(input.substr(h-5, 2)) + s + ost;
    ost = st/60;
    if (st >= 60)
        st -= 60;
    num = to_string(st);
    while (num.length() != 2) {
        num = '0' + num;
    }
    for (unsigned int i = 0; i < 2; i++) {
        input[h-5+i] = num[i];
    }

    st = stoi(input.substr(h-8, 2)) + m + ost;
    ost = st/60;
    if (st >= 60)
        st -= 60;
    num = to_string(st);
    while (num.length() != 2) {
        num = '0' + num;
    }
    for (unsigned int i = 0; i < 2; i++) {
        input[h-8+i] = num[i];
    }

    st = stoi(input.substr(h-11, 2)) + ho + ost;
    ost = st/60;
    if (st >= 60)
        st -= 60;
    num = to_string(st);
    while (num.length() != 2) {
        num = '0' + num;
    }
    for (unsigned int i = 0; i < 2; i++) {
        input[h-11+i] = num[i];
    }
}

void changeTime(string &input) {
    changePart(11, input);
    changePart(28, input);
}

int main() {
    bool new_line = true, line = false;
    string dummy, change, input;
    char dum;
    cin >> dummy >> change;

    stringstream ss(change);
    ss >> ho >> dum >> m >> dum >> s >> dum >> u;
    cin.ignore();

    while (getline(cin,input)) {
        if (new_line) {
            line = true;
            new_line = false;
        } else if (line) {
            changeTime(input);
            line = false;
        }

        if (input.empty()) new_line = true;

        cout << input << endl;
    }

    return 0;
}