PAT 甲级 1006 Sign In and Sign Out

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <algorithm>
 5
 6 using namespace std;
 7 struct oi{
 8     string name;
 9     int h1, m1, j1;
10     int h2, m2, j2;
11 };
12 int bijiao1(oi x, oi y)
13 {
14     if (x.h1!=y.h1)
15         return x.h1<y.h1;
16     else if (x.m1!=y.m1)
17         return x.m1<y.m1;
18     else if (x.j1!=y.j1)
19         return x.j1<y.j1;
20 }
21 int bijiao2(oi x, oi y)
22 {
23     if (x.h2!=y.h2)
24         return x.h2>y.h2;
25     else if (x.m2!=y.m2)
26         return x.m2>y.m2;
27     else if (x.j2!=y.j2)
28         return x.j2>y.j2;
29 }
30 int main()
31 {
32     int n;
33     cin >>n;
34     struct oi ioo[100];
35     for (int i=0; i<n; i++)
36     {
37         cin >>ioo[i].name;
38         scanf ("%2d:%2d:%2d", &ioo[i].h1, &ioo[i].m1, &ioo[i].j1);
39         scanf ("%2d:%2d:%2d", &ioo[i].h2, &ioo[i].m2, &ioo[i].j2);
40     }
41     sort (ioo, ioo+n, bijiao1);
42     cout <<ioo[0].name <<‘ ‘;
43     sort (ioo, ioo+n, bijiao2);
44     cout <<ioo[0].name;
45 }
时间: 2024-08-06 20:16:53

PAT 甲级 1006 Sign In and Sign Out的相关文章

PAT 1006. Sign In and Sign Out (25)

1006. 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 are supposed to f

1006. Sign In and Sign Out (25)——PAT (Advanced Level) Practise

题目信息: 1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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 th

PAT甲级第二次真题练习

1005 Spell It Right (20)(20 分)提问 Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Each case occupies one

pat1006. Sign In and Sign Out (25)

1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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

PAT甲级1005 Spell It Right

题目:PAT甲级 1005 题解:水题.看到题目的第一时间就在想一位一位的mod,最后一加一转换就完事了.结果看到了N最大为10的100的次方,吓得我赶紧放弃这个想法... 发现碰到这种情况用字符串十分好用,这道题应该考察的就是这一点.大致思路就是把数字的每一位放到字符串中,然后通过ASCII码得到每一位的相加结果num,然后把num一位一位的放到stack中,使用stack是因为它先进先出的特性,最后输出就行了. 代码: 1 #include<cstdio> 2 #include<qu

PAT甲级考前整理

终于在考前,刷完PAT甲级130道题目,不容易!!!每天沉迷在刷题之中而不能超脱,也是一种境界.PAT甲级题目总的说卡题目的比较多,卡测试点的比较少,有些题目还会有题意混淆,这点就不吐槽了吧.静下心来耍这130道题,其实磨练的是一种态度与手感,养成的是一种习惯.热爱AC没有错!! 130道题目主要的考点: 1.排序:快速排序,直接插入排序,希尔排序,分治排序,堆排序. 2.图论:拓扑排序.最短路径.深度搜索.广度搜索. 3.树:树的遍历.完全二叉树.AVL. 4.其他:并查集,模拟,哈希.背包.

PAT乙级1006题python3代码

PAT乙级1006题python3代码 目录 PAT乙级1006题python3代码 目录 代码 题目: 让我们用字母B来表示"百".字母S表示"十",用"12-n"来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数.例如234应该被输出为BBSSS1234,因为它有2个"百".3个"十".以及个位的4. 输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000). 输出

PAT 甲级 A1082 (2019/02/14) NULL(12/25)

1 #include<cstdio> 2 #include<cstring> 3 char strnumber[16][5] = {"ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu", "Ge&quo

PAT甲级考试题库1001 A+B Format 代码实现及相关知识学习

准备参加九年九月份的PAT甲级证书考试,对网站上的题目进行总结分析: 1001题 A+B Format (20 分) Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). 计算a+b的值并以一定格式输出其和sum(数字需要