结构体
noon/moon
这个作者很懒,什么都没留下…
展开
-
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 · 132 阅读 · 0 评论 -
P1003 铺地毯 (简单数学)
刚开始感觉有点难,似乎要不停地标记每个点的覆盖地毯编号。看到普及-的难度就又想了想,发现其实是很简单的一道模拟题加一点数学。#include <iostream>using namespace std;struct node{ int x,y; int l,h;};int main(){ int n; cin>>n; no...原创 2019-09-11 22:37:03 · 437 阅读 · 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 · 218 阅读 · 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 · 187 阅读 · 0 评论