fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n;
  7. scanf("%d",&n);
  8. while(n--)
  9. {
  10. int h,m;
  11. scanf("%d:%d",&h,&m);
  12. // printf("%d %d\n",h,m);
  13. int u1=0,u=0,l=11;
  14. u1 = 23-h;
  15. if(m==0)u1++;
  16. // printf("u1 %d\n",u1);
  17. for(int i=0;i<(u1==24?23:u1);i++)
  18. {
  19. // printf("u %d l %d\n",u,l);
  20. u+=l;
  21. l--;
  22. if(l==0)l=12;
  23. }
  24. // printf("u %d\n",u);
  25. u += 23-h;
  26. if(m<=30)u++;
  27. printf("%d\n",u);
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5520KB
stdin
4
23:00
09:11
23:31
00:00
stdout
12
114
0
168