2019-03-13 22:45:13 +00:00
|
|
|
#include <stdio.h>
|
2019-03-13 12:06:45 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2019-03-13 22:35:47 +00:00
|
|
|
int y;
|
|
|
|
int m;
|
|
|
|
int d;
|
2019-03-13 22:37:32 +00:00
|
|
|
int ko;
|
2019-03-13 12:06:45 +00:00
|
|
|
scanf("%d.%d.%d", &d, &m, &y);
|
|
|
|
if(y>=0 && y<=9999)
|
|
|
|
{
|
2019-03-13 22:37:32 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
2019-03-13 22:45:13 +00:00
|
|
|
|
2019-03-13 22:46:58 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
2019-03-13 22:46:58 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:46:58 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(m>=1 && m<=12)
|
2019-03-13 12:06:45 +00:00
|
|
|
{
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
2019-03-13 22:46:58 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
2019-03-13 22:46:58 +00:00
|
|
|
if(ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
if((d>=1 && d<=31) && (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12))
|
2019-03-13 12:06:45 +00:00
|
|
|
{}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:44:28 +00:00
|
|
|
else if((d>=1 && d<=30) && m==4 || m==6 || m==9 || m==11)
|
|
|
|
{}
|
|
|
|
|
2019-03-13 22:48:57 +00:00
|
|
|
while (ko = 0){
|
|
|
|
return 0;}
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if((d>=1 && d<=28) && m==2)
|
2019-03-13 12:06:45 +00:00
|
|
|
{}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if(d==29 && m==2 && (y%400==0 ||(y%4==0 && y%100!=0)))
|
2019-03-13 12:06:45 +00:00
|
|
|
{}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else{
|
2019-03-13 12:06:45 +00:00
|
|
|
printf("Nespravny datum\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
2019-03-13 12:06:45 +00:00
|
|
|
{
|
|
|
|
printf("Nespravny datum\n");
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 12:06:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2019-03-13 22:45:13 +00:00
|
|
|
}
|
2019-03-13 12:06:45 +00:00
|
|
|
else
|
|
|
|
{
|
2019-03-13 22:34:52 +00:00
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
printf("Nespravny datum\n");
|
2019-03-13 12:06:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2019-03-13 22:44:28 +00:00
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d };
|
2019-03-13 12:06:45 +00:00
|
|
|
t.tm_mday += 7;
|
|
|
|
mktime(&t);
|
2019-03-13 22:45:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(t.tm_mday <10 && t.tm_mon+1 < 10){
|
2019-03-13 12:06:45 +00:00
|
|
|
printf(" %d.0%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900);
|
|
|
|
}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if(t.tm_mday < 10){
|
2019-03-13 12:06:45 +00:00
|
|
|
printf(" %d.%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900);
|
|
|
|
}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if(t.tm_mon+1 < 10){
|
2019-03-13 12:06:45 +00:00
|
|
|
printf("%d.0%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900);
|
|
|
|
}
|
2019-03-13 22:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else{
|
2019-03-13 12:06:45 +00:00
|
|
|
printf("%d.%d.%d\n\n", t.tm_mday, t.tm_mon+1, t.tm_year+1900);
|
|
|
|
}
|
|
|
|
|
2019-03-13 22:45:13 +00:00
|
|
|
}
|