Rezultati

Up. imeNalogaJezikRezultatČas oddaje
functor2018 Podnapisi C++ 100/100OK 10. maj '18 @ 16:53

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 1,457 MiB 0,000 s OK
#2 7/7 1,488 MiB 0,004 s OK
#3 7/7 1,488 MiB 0,000 s OK
#4 7/7 1,488 MiB 0,002 s OK
#5 7/7 1,461 MiB 0,000 s OK
#6 7/7 1,465 MiB 0,000 s OK
#7 7/7 1,488 MiB 0,000 s OK
#8 7/7 1,488 MiB 0,000 s OK
#9 7/7 1,488 MiB 0,000 s OK
#10 7/7 1,484 MiB 0,003 s OK
#11 7/7 1,488 MiB 0,000 s OK
#12 7/7 1,484 MiB 0,005 s OK
#13 8/8 1,480 MiB 0,004 s OK
#14 8/8 1,457 MiB 0,000 s OK

Ocenjevani program (podnapisi.cpp):
#include<stdio.h>
#include<vector>
#include<string.h>

using namespace std;

struct tim {
	int h;
	int m;
	int s;
	int ms;
};

int to_ms(struct tim t) {
	return (t.h*3600 + t.m*60 + t.s)*1000 + t.ms;
}
int to_ms(int h, int m, int s, int ms) {
	return (h*3600 + m*60 + s)*1000 + ms;
}
struct tim to_time(int h, int m, int s, int ms) {
	struct tim t;
	t.h = h;
	t.m = m;
	t.s = s;
	t.ms = ms;
	return t;
}

struct tim to_time(int tim) {
	struct tim t;
	t.h = ((tim / 1000) / 60) / 60;
	t.m = ((tim / 1000) / 60) % 60;
	t.s = (tim / 1000) % 60;
	t.ms = tim % 1000;
	return t;
}

int main(){
  int h,m,s,ms;
  scanf("%*s %d:%d:%d,%d", &h, &m, &s, &ms);

  int shift = to_ms(h, m, s, ms);
  int n;
  int quit = 1;

  while (quit && scanf("%d", &n) != EOF) {
    printf("%d\n", n);

    int h1, h2, m1, m2, s1, s2, ms1, ms2;
    scanf("%d:%d:%d,%d %*s %d:%d:%d,%d ", &h1, &m1, &s1, &ms1, &h2, &m2, &s2, &ms2);

    struct tim t = to_time(to_ms(h1, m1, s1, ms1) + shift);
    printf("%02d:%02d:%02d,%03d --> ", t.h, t.m, t.s, t.ms);

    t = to_time(to_ms(h2, m2, s2, ms2) + shift);
    printf("%02d:%02d:%02d,%03d\n", t.h, t.m, t.s, t.ms);

    char buffer[256];
    do {
      if (fgets(buffer, 255, stdin) == NULL) {
	quit = 0;
	break;
      }
      printf("%s", buffer);
    }
    while(strcmp(buffer, "\n") != 0);
  }

  return 0;
}