Advertisement
noshin98

uva 11958

Feb 18th, 2017
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i,j,t,n,ch,cm,ah[1000],am[1000],at[1000],d,ans;
  5. while(scanf("%d",&t)==1)
  6. {
  7. for(j=1;j<=t;j++)
  8.  {
  9.  ans=2500;
  10.  scanf("%d",&n);
  11.  scanf("%d:%d",&ch,&cm);
  12.  for(i=0;i<n;i++)
  13.   {
  14.   scanf("%d:%d %d",&ah[i],&am[i],&at[i]);
  15.   d=ah[i]*60+am[i]-ch*60-cm+at[i];
  16.   if(d<at[i])
  17.   d=(ah[i]+24)*60+am[i]-ch*60-cm+at[i];
  18.   if(d<ans)
  19.   ans=d;
  20.   }
  21.  printf("Case %d: %d\n",j,ans);
  22.  }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement