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);
    }
}
时间: 2024-10-22 16:32:56

codeforces Gym 100500 J. Bye Bye Russia的相关文章

codeforces GYM 100114 J. Computer Network 无相图缩点+树的直径

题目链接: http://codeforces.com/gym/100114 Description The computer network of “Plunder & Flee Inc.” consists of n servers and m two-way communication links. Two servers can communicate either through a direct link, or through a chain of links, by relayi

codeforces Gym 100187J J. Deck Shuffling dfs

J. Deck Shuffling Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/J Description The world famous scientist Innokentiy continues his innovative experiments with decks of cards. Now he has a deck of n cards and k s

codeforces GYM 100114 J. Computer Network tarjan 树的直径 缩点

J. Computer Network Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description The computer network of “Plunder & Flee Inc.” consists of n servers and m two-way communication links. Two servers can communicate either thr

codeforces gym 100357 J (网络流)

题目大意 有n种物品,m种建筑,p个人. n,m,p∈[1,20] 每种建筑需要若干个若干种物品来建造.每个人打算建造一种建筑,拥有一些物品. 主角需要通过交易来建造自己的建筑,交易的前提是对方用多余的物品来换取自己需要的物品. 询问主角是否能建造成功自己的建筑,并给出方案. 解题分析 超级恶心的读入,而且有一组数据的给出方式里没有逗号,和样例所示不同= = 根据py的性质很容易想到用网络流来做.将每种物品拆成x,y两份. 若主角多了a物品b件,连一条S到物品a,x部流量为b的边. 若主角少了a

CodeForces Gym 100500A A. Poetry Challenge DFS

Problem A. Poetry Challenge Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description Let’s check another challenge of the IBM ICPC Chill Zone, a poetry challenge. One says a poetry string that starts with a

codeforces Gym 100500H A. Potion of Immortality 简单DP

Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description Noura Boubou is a Syrian volunteer at ACM ACPC (Arab Collegiate Programming Contest) since 2011. She graduated from Tishreen Un

Codeforces gym Hello 2015 Div1 C and Div2 E

Codeforces gym 100570 problem C Codeforces gym 100571 problem E Problem 给一个N行M列的矩阵Ma,进行Q次(Q<=10)查询,每次给定一个K,问有多少子矩阵,满足最大值max - 最小值min <=K. Limits Time Limit(ms): 8000 Memory Limit(MB): 512 N, M: [1, 400] Q: [1, 10] Ma(i, j), K: [1, 10^9] Solution (Th

Codeforces Gym 100496J(模拟乱搞,线段相交)

题意:给一个M*N的矩形区域,有M*N个方格,有些方格为空(可到达),有些非空(不可达).现A和B在博弈,他们任选两个不同的空格,站在各自的格子中央,A可以移动,但只能进行一次行方向或列向方移动,移动后仍然在格子中央.A如果移动到一个位置使得B看不见他,则A获胜.B看不见A的条件是存在一个非空格子与B到A的线段相切或相交.问,对于每个空格子,A站在上面,是否无论B在哪里,他都可以移动到一个安全位置. A可以选择不移动,题目保证至少有两个空格子,每次移动只能进行横向或竖向移动,不能都进行.空格子内

codeforces Gym 100500C D.Hall of Fame 排序

Hall of Fame Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description It was the second day of IBM Chill Zone, and it was the time for distributing the prizes. Unfortunately due to unknown reasons, the org