A1006. Sign In and Sign Out (25)

C# - 更简洁代码的全局使用指令 通过使用全局 using 指令,您可以使代码文件更清晰,并更专注于它们包含的特定逻辑,而不是被重复的 using 语句弄乱。在 C# 中,全局 using 指令是一项允许您指定在整个项目中全局应用的 using 指令的功能。这可以显着减少文件中的样板代码量,特别是对于常用的命名空间。声明后,全局 using 指令将应用于项目中的所有源文件。这意味着您不需要在每个文件中重复常见的 using 指令。声明全局 using 指令。声明全局使用:您可以在任何 C# 文件中使用关键字前面的修饰符。 阅读详情

A1006

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day.

Input Specification:

Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:

ID_number Sign_in_time Sign_out_time

where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.

Output Specification:

For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.

Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.

Sample Input:
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40
Sample Output:
SC3021234 CS301133
我的AC代码如下:

#include <cstdio>
#include <cstring>
struct Node {
    char Id[20];
    int time;
};
Node first, last;
int main() {
    int n;
    char Id[20];
    int time1, time2;
    first.time = 235959;
    last.time = 0;
    int h1, h2, m1, m2, s1, s2;
    scanf("%d", &n);
    while (n--) {
        scanf("%s %d:%d:%d %d:%d:%d", Id, &h1, &m1, &s1, &h2, &m2, &s2);
        time1 = h1 * 10000 + m1 * 100 + s1;
        time2 = h2 * 10000 + m2 * 100 + s2;
        if (first.time >= time1) {
            strcpy(first.Id, Id);
            first.time = time1;
        }
        if (last.time <= time2) {
            strcpy(last.Id, Id);
            last.time = time2;
        }
    }
    printf("%s %s", first.Id, last.Id);
    return 0;
}



K-GAS解读(08) 大众kgas标准,大众及其供应商kgas 阅读详情

相关推荐

【MATLAB】绘制泽尼克多项式

上次只给了公式没有给代码,很多小伙伴表示不是很认可。今天直接把代码发上来了。

HPC_ZY 5578

Pat(Advanced Level)Practice--1006(Sign In and Sign Out)

Pat1006代码 题目描述: At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of sig

奋起的Coder。。。 1139

2025年MathorCup数学应用挑战赛【B题完整论文】附参考代码(免费分享)

摘。

RS_handy的博客 2694

C# 10 中的新增功能

C# 10 向 C# 语言添加了以下功能和增强功能: 记录结构 结构类型的改进 内插字符串处理程序 指令 文件范围的命名空间声明 扩展属性模式 对 Lambda 表达式的改进 可使用内插字符串 记录类型可密封 改进型明确赋值 在同一析构中可同时进行赋值和声明 可在方法上使用属性 CallerArgumentExpression 属性 增强的pragma .NET 6 支持 C# 10。 有关详细信息,请参阅C# 语言版本控制。 可以通过.NET 下载页下载最新 6 ....

李赛赛的专栏 1798

TP4056在单节锂电池充电管理中的创新应用与电路优化

本文深入探讨了TP4056线性充电管理芯片在单节锂电池充电电路中的创新应用与优化方案。针对“边充边用”的核心挑战,文章详细解析了利用PMOS管构建智能供电切换电路的原理,实现了外部电源与电池供电的无缝、安全切换,有效杜绝了电池“边充边放”的风险。同时,提供了关键的元器件选型、PCB布局布线技巧及常见问题排查指南,为创客和硬件开发者提供了高性价比、高可靠性的锂电池电源管理实践方案。

rock5的博客 501

Allegro PCB设计小技巧:如何用Shift键快速平移复制走线和过孔?

本文深入解析了Allegro PCB设计中利用Shift键进行平移复制的核心技巧。通过对比传统复制粘贴流程,详细演示了如何高效、精准地批量复制走线和过孔,尤其适用于创建等间距电源总线、过孔阵列等场景,能显著提升PCB设计效率与准确性。

pz89012345的博客 555

【C++ primer】12 类{主构造函数}

1、class 默认成员变量private,struct默认是public;

sevnape的专栏 664

Ubuntu20.04下运行LOAM系列:A-LOAM、LeGO-LOAM、SC-LeGO-LOAM、LIO-SAM 和 LVI-SAM

在我第一篇博文Ubuntu 20.04配置ORB-SLAM2和ORB-SLAM3运行环境+ROS实时运行ORB-SLAM2+Gazebo仿真运行ORB-SLAM2+各种相关库的安装的基础环境下跑通A-LOAM首先已经按照上一篇文章已经安装好了ROS noetic、Eigen3.4.0、OpenCV4.2.0和PCL1.10,A-LOAM在Github的开源地址:https://github.com/HKUST-Aerial-Robotics/A-LOAM。接下来根据代码要求,需要安装Ceres,另外环境的变

zardforever123的博客 3万+

c# 解决CS8602告警 解引用可能出现空引用

null 容忍操作符(null-forgiving operator)它的主要作用就是告诉编译器,变量不可能为 null。

一个编程的同学 7489

人工智能面试总结-分类与聚类

目录说说常用的分类算法,以及各自的优缺点?说说为什么正确率有时不能有效评估分类算法?说说什么样的分类器最好?说说聚类算法有哪些衡量标准?(选看)各聚类算法性能比较汇总说说什么是聚类,你知道哪些聚类算法?具体展开介绍你知道的聚类算法?说说K-Means聚类算法流程?说说K-Means聚类算法如何调优?说说K-Means聚类算法如何选择初始点?说说K-Means聚类聚的是特征还是样本?说说K-Means聚类的特征距离是如何计算的?说说聚类与分类的区别?手撕K-Means聚类 说说常用的分类算法,以及各自的优缺点

啥都生的博客 3865

YOLO26改进策略【卷积层】| 引入注意力卷积模块RFAConv,关注感受野空间特征 助力YOLO26精度提升

RFAConv:创新空间注意力和标准卷积运算感受野空间特征是针对卷积核设计的,根据卷积核大小动态生成。以3×3卷积核为例,它由非重叠滑动窗口组成,每个窗口代表一个感受野滑块。

Limiiiing的博客 194

A1006 Sign In and Sign Out 25分

A1006 Sign In and Sign Out 25分 题目描述: 题目大意: 给定一个总人数,在这些人数里边找出最早的人和最晚的人,输出他们的工号。 思路: ①:连接体信息,所以用结构体存储工号,时间。 ②:因为需要比较时间,这里的时间有时、分、秒,不妨把写一个函数,当需要比较时间的时候调用该函数就好,好用又方便。 AC代码: #include<cstdio> struct node{ char num[20]; int h1,m1,s1,h2,m2,s2; }e[100005],

qq_45735298的博客 175

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

[PAT-Advanced] A1006 Sign In and Sign Out (25)

文章目录A1006 Sign In and Sign Out (25point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis A1006 Sign In and Sign Out (25point(s)) At the beginning of every day, the f...

Duke 383

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

PAT A1006 Sign In and Sign Out (25 分)

题意 给出n个人进入和出去的时间,求最早进来和最晚出去的人的id。 思路 时间按照字符串输入进来就可以直接比较大小,不用转换成秒。 代码 #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; string id...

一只小羊 257

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

A1006 Sign In and Sign Out (25point(s))

A1006 Sign In and Sign Out (25point(s)) #include<cstdio> #include<algorithm> using namespace std; const int maxm = 1000; int M; struct Node{ char ID[20]; int InTime; int OutTime; } n...

LEOSATA's Blog 1173

A1006 Sign In and Sign Out (25分)

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s, you...

赵丽颖 180

PAT A1006 Sign In and Sign Out (25)

PTA跳转:原题链接 这道题相对比较容易,题目大意是先输入(人数),然后输入每个人的(id,开始时间和结束时间),最后输出(最早开始的人的id)和(最晚结束的人的id)。 先来分析题目给的输入输出样本。第一行的"3"代表有3个人(即后续有3行数据),由于"08:00:00"是最早的,先输出这个人的id,由于"21:58:40"是最晚的,再输出这个人的id。 输入: 3 CS301111 15:30...

koori_145的博客 308

a1006. Sign In and Sign Out (25)

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you

a530877647的博客 263

PAT_A 1006. Sign In and Sign Out (25)

1006. Sign In and Sign Out (25) scanf("%s %02d:%02d:%02d %02d:%02d:%02d",id,&a,&b,&c,&d,&e,&f);//这方法很好,注意是int*

longtails的博客 599

A1006. Sign In and Sign Out(25)

25/25,一遍过了,很开心。 #include<bits/stdc++.h> using namespace std; struct record{ string id; string in_time; string out_time; }; vector<record> records; void solve(){ int m; ...

weixin_33873846的博客 158

pat 甲级 A1006 Sign In and Sign Out (25分)

题目链接: https://pintia.cn/problem-sets/994805342720868352/problems/994805516654460928 题目大意: 给出一日中进出机房人员的信息,要求你给出机房开关门人的ID编号。进出人员的信息格式:ID编号 进入时间 出去时间。时间以时:分:秒格式给出,24小时计时,保证所有人的信息都是有效的,即进入时间早于出去时间。 ...

dutmathjc的博客 187
上一篇: A1002. A+B for Polynomials (25)
下一篇: A1009. Product of Polynomials (25)
DemonInside
博客等级 码龄10年 1粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值