当前位置:网站首页>PAT甲级 1025 PAT Ranking
PAT甲级 1025 PAT Ranking
2022-06-27 02:44:00 【九是否非随机的称呼】
注意ranking是累加
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
struct testee{
string ID;
int score;
int loc;
int wholerank;
int locrank;
};
bool compareloc(const testee &a, const testee &b){
if(a.score > b.score) return true;
else if(a.score < b.score) return false;
else if(a.score == b.score){
if(a.ID <= b.ID) return true;
else return false;
}
}
int main(void){
string s, s0, sk;
int m, n, k, i, j, f, h;
cin>>n;
vector<testee> v, vx;
testee tst;
vector<int> vtr;
for(i = 0; i < n; i++){
cin>>m;
vtr.push_back(m);
for(j = 0; j < m; j++){
cin>>tst.ID>>tst.score;
tst.loc = i + 1;
vx.push_back(tst);
}
}
h = 0;
for(i = 0; i < n; i++){
vector<testee> v0;
k = 1;
for(j = 0; j < vtr[i]; j++){
tst = vx[h++];
v0.push_back(tst);
}
sort(v0.begin(), v0.end(), compareloc);
if(v0.size()>0) v0[0].locrank = k;
for(j = 1; j < vtr[i]; j++){
k++;
if(v0[j - 1].score==v0[j].score) v0[j].locrank = v0[j - 1].locrank;
else v0[j].locrank = k;
}
for(j = 0; j < vtr[i]; j++) v.push_back(v0[j]);
}
k = 1;
sort(v.begin(), v.end(), compareloc);
if(v.size()>0) v[0].wholerank = k;
for(j = 1; j < v.size(); j++){
k++;
if(v[j - 1].score==v[j].score) v[j].wholerank = v[j - 1].wholerank;
else v[j].wholerank = k;
}
cout<<v.size()<<endl;
for(j = 0; j < v.size(); j++) cout<<v[j].ID<<" "<<v[j].wholerank<<" "<<v[j].loc<<" "<<v[j].locrank<<endl;
return 0;
} https://github.com/ZouJiu1/PAT
https://github.com/ZouJiu1/PAT
边栏推荐
- Would rather go to 996 than stay at home! 24 years old, unemployed for 7 months, worse than work, no work
- Fork (), exec (), waitpid (), $? > > in Perl 8 combination
- Precautions for using sneakemake
- Canvas particles: mouse following JS effect
- 2022 operation of simulated examination platform for tea artist (Senior) work license question bank
- Flink learning 3: data processing mode (stream batch)
- Yalm 100b: 100billion parameter open source large model from yandex, Russia, allowing commercial use
- three.js多米诺骨牌js特效
- Oracle/PLSQL: Ltrim Function
- Oracle/PLSQL: From_ Tz function
猜你喜欢

Flink learning 4:flink technology stack

Geometric distribution (a discrete distribution)

Flink学习2:应用场景

超级详细,2 万字详解,吃透 ES!

ConstraintLayout(约束布局)开发指南

Parameter estimation -- Chapter 7 study report of probability theory and mathematical statistics (point estimation)

学习太极创客 — MQTT 第二章(一)QoS 服务质量等级

参数估计——《概率论及其数理统计》第七章学习报告(点估计)

Flink learning 5: how it works

超級詳細,2 萬字詳解,吃透 ES!
随机推荐
Flink学习5:工作原理
TechSmith Camtasia latest 2022 detailed function explanation Download
2022年氯碱电解工艺试题及答案
Oracle/PLSQL: Ltrim Function
Canvas particles: mouse following JS effect
Installing the Damon database using the command line
剑指Offer || :栈与队列(简单)
Learn Tai Chi maker mqtt (IX) esp8266 subscribe to and publish mqtt messages at the same time
参数估计——《概率论及其数理统计》第七章学习报告(点估计)
Flink Learning 2: Application Scenarios
Oracle/PLSQL: Translate Function
Constraintlayout Development Guide
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
Learn Tai Chi Maker - mqtt (VIII) esp8266 subscribe to mqtt topic
Mmdetection uses yolox to train its own coco data set
Oracle/PLSQL: VSize Function
"All majors are persuading them to quit." is it actually the most friendly to college students?
[micro service sentinel] degradation rules slow call proportion abnormal proportion abnormal constant
学习太极创客 — MQTT 第二章(一)QoS 服务质量等级
学习太极创客 — MQTT 第二章(二)ESP8266 QoS 应用