1028 List Sorting (25 分)】的更多相关文章

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 (≤10​5 ) and C, where N is the number…
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…
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…
题意: 输入一个正整数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…
1052 Linked List Sorting (25 分)   A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list,…
题目链接: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…
题目链接 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…
#include <vector> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; struct MyStruct { ]; ]; int grade; }; int cmp1(MyStruct a,MyStruct b) { ); } int cmp2(MyStruct a,MyStruct b) { ) ); ; } int cmp3(MyS…
时间卡的比较死,用string会超时. #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<iostream> #include<algorithm> using namespace std; struct X { int id; ]; int score; }s[+]; int n,C; bool cmp1(const X&…