Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3297 吴奕希 打字比赛 C++ Accepted 1 MS 304 KB 605 2024-05-04 18:40:20

Tests(10/10):


Code:

# include<iostream> # include<algorithm> using namespace std; struct Player{ int id, speed, acc; float score; void input(int x){ cin>>speed>>acc; score = speed*1.0*acc/100; id = x; } void output(){ printf("%d %.2f\n", id, score); } }; bool cmp(Player p1, Player p2){ if(p1.score==p2.score)return p1.id<p2.id; return p1.score>p2.score; } Player p[3000]; int n; int main(){ cin>>n; for(int i = 0; i < n; i++)p[i].input(i+1); sort(p, p+n, cmp); for(int i = 0; i < n; i++)p[i].output(); return 0; }