codeforces Gym 100500 J. Bye Bye Russia

本文介绍了一个简单的编程竞赛题目,要求计算两个时间点之间的分钟差。通过输入当前时间和期望醒来的时间,来确定设置计时器所需的分钟数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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);
    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值