Divya_123

Untitled

Nov 26th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4. #include<stdlib.h>
  5. char ar[100000],st[100000];
  6. int search(char ar[])
  7. {
  8.     if(!strcmp(ar,"monday"))
  9.     return 1;
  10.     if(!strcmp(ar,"tuesday"))
  11.     return 2;
  12.     if(!strcmp(ar,"wednesday"))
  13.     return 3;
  14.     if(!strcmp(ar,"thursday"))
  15.     return 4;
  16.     if(!strcmp(ar,"friday"))
  17.     return 5;
  18.     if(!strcmp(ar,"saturday"))
  19.     return 6;
  20.     if(!strcmp(ar,"sunday"))
  21.     return 0;
  22. }
  23. int main()
  24. {
  25.     int i,t;
  26.     scanf("%d",&t);
  27.     while(t--)
  28.     {
  29.         int l,r,d;
  30.         scanf("%s",&ar);
  31.         scanf("%s",&st);
  32.         scanf("%d %d",&l,&r);
  33.         int a=search(ar);
  34.         int b=search(st);
  35.         d=b-a;
  36.         if(d<0)
  37.             d=d+7+1;
  38.         else
  39.             d=d+1;
  40.     //   int d2=d+7;
  41.            printf("\nd=%d,l= %d, r= %d, \n ",d,l,r);
  42.         if(d>=l&&(d+7)>r)
  43.             printf("\n%d",d);
  44.         else if(d>=l&&(d+7)<=r)
  45.             printf("\nmany");
  46.          else
  47.          printf("\nimpossible");
  48.        
  49.     }
  50.     return 0;
  51. }
Add Comment
Please, Sign In to add comment