PAT 1028 List Sorting[排序][一般]】的更多相关文章

1028 List Sorting (25)(25 分) Excel can sort records according to any column. Now you are supposed to imitate this function. Input Each input file contains one test case. For each case, the first line contains two integers N (<=100000) and C, where N…
题目 Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file contains one test case. For each case, the first line contains two integers N (≤10​5 ) and C, where N is the number…
#include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; class Stu { public: ]; ]; char grade; }; bool cmp_id(const Stu* a, const Stu* b) { ; } bool cmp_name(const Stu* a, const Stu* b) { in…
1028 List Sorting (25 分)   Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file contains one test case. For each case, the first line contains two integers N (≤) and C, wh…
Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file contains one test case. For each case, the first line contains two integers N (≤) and C, where N is the number of reco…
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include <queue> using namespace std; /* 水排序 */ +; int n,c; struct Stu{ int ID; ]; int grade; }stu[maxn]; bool cmpID(Stu s1…
题目链接 https://www.patest.cn/contests/pat-a-practise/1028 思路 就按照 它的三种方式 设计 comp 函数 然后快排就好了 但是 如果用 c++ 中的 string 保存名字的话 就会超时 所以 用 c 里面的 char *s 就可以过 AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #incl…
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1028 题目描述: Excel can sort records according to any column. Now you are supposed to imitate this function. Input Each input file contains one test case. For each case, the first line contains two inte…
Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file contains one test case. For each case, the first line contains two integers N (≤10​5​​) and C, where N is the number o…
题意: 输入一个正整数N(<=100000)和C(C属于{1,2,3}),接下来输入N行,每行包括学生的六位学号(习惯用string输入,因为可能有前导零),名字和成绩(正整数).输出排序后的信息,排序根据C决定. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; typedef struct student{ string id,name; int g…