奶牛贝茜已经厌倦了牛奶生产行业,并希望转而从事令人兴奋的计算机行业。
为了提高自己的编程能力,她决定参加在线 USACO 比赛。
由于她注意到比赛开始于 20112011 年 1111 月 1111 日(11/11/1111/11/11),于是她决定下载问题并在 11/11/1111/11/11 上午 11:1111:11 开始答题。
不幸的是,贝茜的时间管理能力很差,因此她想编写一个快速程序来帮助她确保比赛时间不超过 33 小时(180180 分钟)。
给定她停止答题的日期和时间,请帮助贝茜计算她在比赛中花费的总分钟数。
输入格式
共一行,包含三个整数 D,H,MD,H,M。表示贝茜停止答题的日期,小时,分钟。
用 2424 小时制记录时间。
输出格式
输出贝茜在比赛中花费的总分钟数。
如果结束时间比开始时间还早,则输出 −1−1。
数据范围
11≤D≤1411≤D≤14,
0≤H≤230≤H≤23,
0≤M≤590≤M≤59
输入样例:
12 13 14
输出样例:
1563
#include <iostream> #include <cstring> #include <algorithm> using namespace std; int main() { int d,h,m; cin>>d>>h>>m; if(d<11||d==11&&h<11||d==11&&h==11&&m<11) { cout<<-1; } else { cout<<((d-11)*24+h-11)*60+m-11; } return 0; }
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int d, h, m;
cin >> d >> h >> m;
int a = 11 * 1440 + 11 * 60 + 11;
int b = d * 1440 + h * 60 + m;
if (a > b) puts("-1");
else cout << b - a << endl;
return 0;
}
小龙🐉愚钝,水题还发文,哎,谁让我为了51奖章呢
也是在蓝桥杯比赛落下帷幕,多刷刷acwing每日一题,毕竟花了我1ac币呢。
小龙🐉就吐了,为啥我这题才0.01ac币,我脸黑啊
下面那块代码是y 总的,为啥就0.97ac币,┭┮﹏┭┮