#include <bits/stdc++.h>
using namespace std;
#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;
void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}
const int maxn = 310;
char str[100][maxn];
int a[maxn], b[maxn], c[maxn], d[maxn];
int aa[maxn], bb[maxn], cc[maxn], dd[maxn];
int v;
bool g[maxn];
void output(int x, int dig)
{
if(dig == 2)
{
if(x < 10) pf("0%d",x);
else pf("%d",x);
}
else
{
if(x < 10) pf("00%d",x);
else if(x <100) pf("0%d",x);
else pf("%d",x);
}
}
int main()
{
#ifdef MPS
fp("1.in","r",stdin);
fp("1.out","w",stdout);
#endif
bool tag = false;
int m = 0;
fo(t,1,100)
{
++ m;
gets(str[t]+1);
if(str[t][3] == ':')
{
g[m] = true;
a[t] = (str[t][1]-'0')*10+str[t][2]-'0';
b[t] = (str[t][4]-'0')*10+str[t][5]-'0';
c[t] = (str[t][7]-'0')*10+str[t][8]-'0';
d[t] = ((str[t][10]-'0')*10+str[t][11]-'0')*10+str[t][12]-'0';
aa[t] = (str[t][1+17]-'0')*10+str[t][2+17]-'0';
bb[t] = (str[t][4+17]-'0')*10+str[t][5+17]-'0';
cc[t] = (str[t][7+17]-'0')*10+str[t][8+17]-'0';
dd[t] = ((str[t][10+17]-'0')*10+str[t][11+17]-'0')*10+str[t][12+17]-'0';
}
if(tag)
{
int s, f, n = strlen(str[t]+1);
if(str[t][1] == '-') s = 2, f = -1; else s = 1, f = 1;
fo(i,s,n)
{
v = v * 10 + str[t][i] - '0';
}
v *= f;
break;
}
if(str[t][1] == '#') tag = true;
}
fo(i,1,m-1)
{
if(!g[i]) puts(str[i]+1);
else
{
if(v < 0)
{
fo(x,1,-v)
{
d[i] --;
if(d[i] == -1)
{
d[i] = 999;
c[i] --;
if(c[i] == -1)
{
c[i] = 59;
b[i] --;
if(b[i] == -1)
{
b[i] = 59;
a[i] --;
}
}
}
dd[i] --;
if(dd[i] == -1)
{
dd[i] = 999;
cc[i] --;
if(cc[i] == -1)
{
cc[i] = 59;
bb[i] --;
if(bb[i] == -1)
{
bb[i] = 59;
aa[i] --;
}
}
}
}
}
else
{
d[i] += v;
int t = d[i]/1000; d[i] %= 1000;
c[i] += t; t = c[i]/60; c[i] %= 60;
b[i] += t; t = b[i]/60; b[i] %= 60;
a[i] += t;
dd[i] += v; t = dd[i]/1000; dd[i] %= 1000;
cc[i] += t; t = cc[i]/60; cc[i]%=60;
bb[i] += t; t = bb[i]/60; bb[i]%=60;
aa[i] += t; t = aa[i]/60; aa[i]%=60;
}
output(a[i],2); pf(":");
output(b[i],2); pf(":");
output(c[i],2); pf(",");
output(d[i],3); pf(" --> ");
output(aa[i],2); pf(":");
output(bb[i],2); pf(":");
output(cc[i],2); pf(",");
output(dd[i],3); pf("\n");
}
}
return 0;
}
Compilation message
titlovi.cpp: In function 'int main()':
titlovi.cpp:66:3: error: 'gets' was not declared in this scope
gets(str[t]+1);
^~~~
titlovi.cpp:66:3: note: suggested alternative: 'fgets'
gets(str[t]+1);
^~~~
fgets