![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
noon/moon
这个作者很懒,什么都没留下…
展开
-
PAT乙级 1004 成绩排名 (模拟/排序)
模拟:#include<iostream>using namespace std;int main(){ int n;cin>>n; int maxn=0,minn=100; string max_name,max_num,min_name,min_num; while(n--){ string t_name,t_num...原创 2019-09-06 17:12:18 · 82 阅读 · 0 评论 -
PAT乙级 1015 德才论 (排序)
第三、四个测试点如果用cin,cout会比scanf,printf多出三至五倍的时间#include <bits/stdc++.h>using namespace std;struct stu{ int num,de,cai;};bool cmp(stu a,stu b){ if(a.de+a.cai!=b.de+b.cai) return a...原创 2019-09-07 23:03:06 · 128 阅读 · 0 评论 -
PAT乙级 1058 选择题
#include <bits/stdc++.h>using namespace std;struct q{ int full,all,right,wrong,num;//分值,总选项数,对的选项数,错的次数,题号 char ans[5]={0};//对的选项设置为1};bool cmp(q a,q b)//写错的人越多的题越靠前,若排序后最靠前的没有一个人错则...原创 2019-08-15 23:24:18 · 206 阅读 · 0 评论 -
P1056 排座椅(排序/结构体)
贪心排过后还要再按序号从小到大再排一遍#include <iostream>#include <algorithm>using namespace std;struct Node{ int num;// 行/列号 int cnt;// 该行/列说话人数};bool cmp(Node a,Node b){//第一遍将说话人数多的行列排到前面 ...原创 2019-09-12 15:31:01 · 174 阅读 · 0 评论 -
P1012 拼数(排序)
比较s[i]+s[j]和s[j]+s[i],如果后者大就交换s[i]和s[j]的位置比如321和32,32132<32321,而二者比较时321是大于32的,所以此时需要交换位置#include <iostream>#include <algorithm>using namespace std;int main(){ int n;cin>>...原创 2019-09-17 00:16:19 · 123 阅读 · 0 评论 -
HDU 2000 ASCII码排序
感觉只有三个字符太简单了#include <bits/stdc++.h>using namespace std;#define N 3int main(){ char a[N],i; while(1){ for(i=0;i<N&&cin>>a[i];i++); if(i!=N) break; ...原创 2019-09-17 21:09:05 · 57 阅读 · 0 评论