codeforces Gym 100500 J. Bye Bye Russia
Problem J. Bye Bye Russia
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/gym/100500/attachments
Description
It was the last day at Russia, after the World Finals has 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 an unknown reason his phone alarm was not working, and he needed something to wake him up. Fortunately his stopwatch was just working fine, and it worked in count down mode, and it supported only minutes. You will 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 will be the number of test cases T. The following T lines each will contain 4 integers hc mc hw mw which represent the current time(hours, and minutes), and the wake up time(hours, minutes). 1 ≤ T ≤ 100 0 ≤ hc, hw ≤ 23 0 ≤ mc, mw ≤ 59 Note that both times will 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
题意
给你两个时间,问你差了多少分钟
题解:
水题……
代码
#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> typedef long long ll; using namespace std; //freopen("D.in","r",stdin); //freopen("D.out","w",stdout); #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) #define test freopen("test.txt","r",stdin) const int maxn=202501; #define mod 1000000007 #define eps 1e-9 const int inf=0x3f3f3f3f; const ll infll = 0x3f3f3f3f3f3f3f3fLL; inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } //************************************************************************************* int main() { int t=read(); for(int cas=1;cas<=t;cas++) { int a=read(),b=read(),c=read(),d=read();; b=a*60+b,d=c*60+d; printf("Case %d: %d\n",cas,d-b); } }