Codeforces Gym 100500 J. Bye Bye Russia

Source: Internet
Author: User

Problem J. Bye Bye Russia
Time Limit:20 Sec

Memory limit:256 MB

Topic Connection

Http://codeforces.com/gym/100500/attachments

Description

It was the last day at Russia and after the world Finals had ended. Coach Fegla was travelling back to Cairo on the same day but later. Coach Fegla was really tired, and he had to sleep before he headed to the Airport. Due to a unknown reason his phone alarm is not working, and he needed something to wake him up. Fortunately his stopwatch is just working fine, and it worked in count down mode, and it supported only minutes. You'll be given the current time, and the time he wished to wake up, help him determine the number of needed minutes to Configure the stopwatch properly.

Input

The first line would be the number of test cases T. The following T lines each would contain 4 integers HC MC HW MW which represent the current time (hours, and minutes), and T He wake up time (hours, minutes). 1≤t≤100 0≤HC, hw≤23 0≤MC, mw≤59 Note that both times would be on the same day, and the wake up time comes after The current time. Assume the day starts at 00:00 and ends at 23:59.

Output

For each test case, print a single line containing:case_x:_y x is the case number starting from 1. Y is the required answer. Replace underscores with spaces.

Sample Input

2 1 22 13 21 2 35 21 35

Sample Output

Case 1:719 Case 2:1140

HINT

Test instructions

I'll give you two hours to ask how many minutes you're in.

The following:

Water problem ...

Code

#include <cstdio>#include<cmath>#include<cstring>#include<ctime>#include<iostream>#include<algorithm>#include<Set>#include<vector>#include<sstream>#include<queue>#include<typeinfo>#include<fstream>#include<map>#include<stack>typedefLong Longll;using namespacestd;//freopen ("d.in", "R", stdin);//freopen ("D.out", "w", stdout);#defineSspeed ios_base::sync_with_stdio (0); Cin.tie (0)#defineTest Freopen ("Test.txt", "R", stdin)Const intmaxn=202501;#defineMoD 1000000007#defineEPS 1e-9Const intinf=0x3f3f3f3f;Constll infll =0x3f3f3f3f3f3f3f3fll;inline ll Read () {ll x=0, f=1;CharCh=GetChar ();  while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();}  while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} returnx*F;}//*************************************************************************************intMain () {intt=read ();  for(intcas=1; cas<=t;cas++)    {        intA=read (), B=read (), C=read (), d=read ();; b=a* -+b,d=c* -+D; printf ("Case %d:%d\n", cas,d-b); }}

Codeforces Gym 100500 J. Bye Bye Russia

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.