题目链接

https://www.patest.cn/contests/gplt/L2-009

思路

用结构体存储,然后结构体排序 注意一下 个人编号是从 1 开始

计数的

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip> using namespace std;
typedef long long LL; const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6; const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e4 + 5;
const int MOD = 1e9 + 7; struct Node
{
int tot, id;
double sum;
}q[maxn]; bool comp(Node x, Node y)
{
if (x.sum == y.sum)
{
if (x.tot == y.tot)
return x.id < y.id;
return x.tot > y.tot;
}
return x.sum > y.sum;
} int main()
{
memset(q, 0, sizeof(q));
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
q[i].id = i;
for (int i = 0; i < n; i++)
{
int k;
scanf("%d", &k);
int id, num;
for (int j = 0; j < k; j++)
{
scanf("%d%d", &id, &num);
q[id - 1].sum += num;
q[id - 1].tot ++;
q[i].sum -= num;
}
}
sort (q, q + n, comp);
for (int i = 0; i < n; i++)
printf("%d %.2lf\n", q[i].id + 1, q[i].sum / 100);
}

最新文章

  1. WebView 载入本地的html
  2. C# 错误代码
  3. Linux多线程编程阅读链接
  4. opencv win7 配置
  5. java类的加载顺序
  6. mybatis只能模糊查询英文不能查询中文
  7. Android Ndef Message解析
  8. kubernetes学习01—kubernetes介绍
  9. mysql-cluster集群配置
  10. Nginx.conf配置文件参数说明与优化
  11. python第三方模块的导入
  12. 解决kali linux 开启ssh服务后连接不上的问题
  13. PHP封装类 【 设置分页 】 !!! 可以直接引用 !!! 都有自己理解的注释,挺详细的,有搜到的朋友可以能帮到你们 【 新手一看练两遍就懂 】
  14. idea 中maven编译速度过慢的问题的解决
  15. linux:ubuntu安装mysql(二)--推荐
  16. linux加入windows域
  17. kubernetes dashboard 安装时出现9090: getsockopt: connection refused错误
  18. 获取不到offsetHeight问题
  19. python(33)多进程和多线程的区别
  20. android--WaveView(波浪形View) 的实现记录

热门文章

  1. ckeditor编辑时 回车 生成一个段落p、解决首行缩进问题
  2. Servlet的API(二)
  3. jQuery的$.fn使用
  4. MVC| Razor 布局-模板页 | ViewStart.cshtml
  5. Android模拟屏幕点击input tap替代解决方案
  6. js 正则匹配 域名【host】
  7. Python内置函数之str()
  8. Java中的各种锁--分类总结
  9. Command &#39;java&#39; not found during running appium
  10. Collective Mindsets (easy)(逻辑题)