-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2139uri.c
70 lines (60 loc) · 1.29 KB
/
2139uri.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
int day(int x, int y);
int main(){
int a,b;
while(scanf("%d%d",&a,&b)!=EOF){
if(a == 12 && b == 24){
printf("E vespera de natal!\n");
}
else if(a == 12 && b == 25){
printf("E natal!\n");
}
else if ( a == 12 && b>25 ){
printf("Ja passou!\n");
}
else if( a == 12 && b<24 ){
printf("Faltam %d dias para o natal!\n",25-b);
}
else {
printf("Faltam %d dias para o natal!\n",day(a,b));
}
}
return 0;
}
int day(int x, int y){
int m ;
if (x == 11){
m = 54-y;
}
else if (x == 10){
m = 85-y;
}
else if (x == 9){
m = 115 -y;
}
else if (x == 8){
m = 146-y;
}
else if ( x == 7){
m = 177 -y;
}
else if (x == 6){
m = 207 -y;
}
else if (x ==5 ){
m = 238 -y;
}
else if (x == 4){
m = 268 - y;
}
else if (x == 3 ){
m = 299 - y;
}
else if (x == 2){
m = 328 - y;
}
else if (x == 1){
m = 359 - y;
}
return m+1 ;
}