cccc L2-009. 抢红包
来源:互联网 发布:python rqalpha 编辑:程序博客网 时间:2024/04/30 00:57
点击打开链接
暴力拍一遍就过了,
注意除以100 不能直接除,在结果除就行了。
#include<stdio.h>#include<string.h>#include<iostream>#include<map>#include<algorithm>#include<vector>#define ll long longusing namespace std;ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b);}struct node{ int n,q=0; double moy=0;}a[11111];int cmp(node a,node b){ if(a.moy==b.moy&&a.q==b.q) return a.n<b.n; else if(a.moy==b.moy) return a.q>b.q; return a.moy>b.moy;}int main(){ int n,m,x; double y; scanf("%d",&n); for(int i=1;i<=n;++i) a[i].n=i; for(int i=1;i<=n;++i){ scanf("%d",&m); for(int j=1;j<=m;++j){ scanf("%d %lf",&x,&y); a[x].moy+=y; a[x].q++; a[i].moy-=y; } } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;++i){ printf("%d %.2lf\n",a[i].n,a[i].moy/100); } return 0;}
0 0
- cccc L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- L2-009. 抢红包
- git 异常
- 《Html5,基础知识、核心技术与前沿案例》阅读笔记- 待续
- c#学习第二天(今天)0.0 嘿
- 2017年清华大学计算机科学与技术系考研小结
- Linux下编写第一个c语言程序hello world
- cccc L2-009. 抢红包
- java 基本数据类型
- openssl命令详解
- Nuc
- ubuntu下c++11的支持问题
- JVM学习01-基本结构
- [算法练习]快速排序的C语言实现
- LeetCode 495. Teemo Attacking
- C语言中的scanf的使用