2020-03-25 14:43:33 +00:00
|
|
|
#include <stdio.h>
|
2020-03-26 10:41:57 +00:00
|
|
|
#include <stdlib.h>
|
2020-03-25 14:43:33 +00:00
|
|
|
#include <string.h>
|
|
|
|
int main()
|
2020-03-26 10:51:13 +00:00
|
|
|
{
|
2020-03-25 14:43:33 +00:00
|
|
|
char *str;
|
|
|
|
str = (char*) malloc(12);
|
|
|
|
scanf("%s",str);
|
|
|
|
int day=0;
|
|
|
|
int m=0;
|
|
|
|
int y=0;
|
2020-03-26 23:12:04 +00:00
|
|
|
int z=0;
|
2020-03-26 10:25:16 +00:00
|
|
|
sscanf(str, "%d.%d.%d", &day, &m, &y);
|
2020-03-26 23:11:24 +00:00
|
|
|
if(y%400==0 ||(y%100!=0 && y%4==0)){
|
|
|
|
z++;
|
|
|
|
}
|
2020-03-26 23:05:17 +00:00
|
|
|
if(m==2){
|
2020-03-26 23:11:24 +00:00
|
|
|
if(z==1 &&day>29){
|
2020-03-26 23:12:44 +00:00
|
|
|
printf("Nespravny datum\n");
|
2020-03-26 22:52:58 +00:00
|
|
|
return 0;
|
2020-03-26 23:05:17 +00:00
|
|
|
}
|
2020-03-26 23:11:24 +00:00
|
|
|
if(z==0 &&day>28){
|
2020-03-26 23:12:44 +00:00
|
|
|
printf("Nespravny datum\n");
|
2020-03-26 23:11:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2020-03-26 23:05:17 +00:00
|
|
|
}
|
2020-03-25 14:43:33 +00:00
|
|
|
day+=7;
|
2020-03-26 10:41:57 +00:00
|
|
|
if(m%2!=0 && day>31){
|
2020-03-25 14:43:33 +00:00
|
|
|
day-=31;
|
|
|
|
m++;
|
|
|
|
}
|
2020-03-26 10:41:57 +00:00
|
|
|
if(m%2==0 && day>30){
|
2020-03-25 14:43:33 +00:00
|
|
|
if(m==2 &&(y%400==0 ||(y%100!=0 && y%4==0))){
|
2020-03-26 10:56:26 +00:00
|
|
|
day-=29;
|
2020-03-26 10:51:13 +00:00
|
|
|
}
|
|
|
|
else if(m==2){
|
2020-03-26 10:56:26 +00:00
|
|
|
day-=28;
|
2020-03-25 14:43:33 +00:00
|
|
|
}
|
|
|
|
else{
|
2020-03-26 10:41:57 +00:00
|
|
|
day-=30;
|
2020-03-25 14:43:33 +00:00
|
|
|
}
|
|
|
|
m++;
|
|
|
|
}
|
|
|
|
if(m>12){
|
|
|
|
m-=12;
|
2020-03-26 10:51:13 +00:00
|
|
|
day--;
|
2020-03-25 14:43:33 +00:00
|
|
|
y++;
|
|
|
|
}
|
2020-03-26 11:06:57 +00:00
|
|
|
if(m>9 && day>9){
|
2020-03-26 10:59:27 +00:00
|
|
|
printf("%d.%d.%d\n",day,m,y);
|
2020-03-26 10:41:57 +00:00
|
|
|
}
|
2020-03-26 11:06:57 +00:00
|
|
|
else if(m<10 && day>9){
|
|
|
|
printf("%d.0%d.%d\n",day,m,y);
|
|
|
|
}
|
|
|
|
else if(m>9 && day<10){
|
|
|
|
printf(" %d.%d.%d\n",day,m,y);
|
|
|
|
}
|
2020-03-26 10:41:57 +00:00
|
|
|
else{
|
2020-03-26 11:06:57 +00:00
|
|
|
printf(" %d.0%d.%d\n",day,m,y);
|
2020-03-26 10:41:57 +00:00
|
|
|
}
|
2020-03-26 10:43:32 +00:00
|
|
|
printf("\n");
|
2020-03-25 14:43:33 +00:00
|
|
|
|
2020-03-26 10:41:57 +00:00
|
|
|
return 0;
|
2020-03-25 14:43:33 +00:00
|
|
|
}
|
|
|
|
|