-
Notifications
You must be signed in to change notification settings - Fork 1
/
event.cpp
69 lines (69 loc) · 1.23 KB
/
event.cpp
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
#include<bits/stdc++.h>
main()
{
int t;
scanf("%d",&t);
while(t--)
{
char s[10],e[9];
int i,j,k=0,l,r,count=0;
scanf("%s %s %d %d",s,e,&l,&r);
{
if(strcmp(s,"monday")==0)
k=1;
else if(strcmp(s,"tuesday")==0)
k=2;
else if(strcmp(s,"wednesday")==0)
k=3;
else if(strcmp(s,"thursday")==0)
k=4;
else if(strcmp(s,"friday")==0)
k=5;
else if(strcmp(s,"saturday")==0)
k=6;
else if(strcmp(s,"sunday")==0)
k=7;
}
{
if(strcmp(e,"monday")==0)
j=1;
else if(strcmp(e,"tuesday")==0)
j=2;
else if(strcmp(e,"wednesday")==0)
j=3;
else if(strcmp(e,"thursday")==0)
j=4;
else if(strcmp(e,"friday")==0)
j=5;
else if(strcmp(e,"saturday")==0)
j=6;
else if(strcmp(e,"sunday")==0)
j=7;
}
int p=j-k;
if(p==0)
{
p=7;
for(i=p+1;i<=r;i+=7)
{
if(i>=l&&i<=r)
count++;
}
if(l==1)
count++;
}
else if(p<0)
p+=7;
for(i=p+1;i<=r;i+=7)
{
if(i>=l&&i<=r)
count++;
}
if(count==1)
printf("%d\n",p+1);
else if(count==0)
printf("impossible\n");
else
printf("many\n");
}
}