cf--2A
//Accepted 100 KB 92 ms //模拟 #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <cmath> #include <algorithm> using namespace std; /** * This is a documentation comment block * 如果有一天你坚持不下去了,就想想你为什么走到这儿! * @authr songt */ ; ]; int cnts; int a[imax_n]; int b[imax_n]; int n; int search(char name[]) { ;i<cnts;i++) { ) return i; } ; } ]; int score[imax_n]; void slove() { cnts=; memset(a,,sizeof(a)); memset(b,,sizeof(b)); ;i<n;i++) { scanf("%s%d",sname[i],&score[i]); int t=search(sname[i]); ) { strcpy(s[cnts],sname[i]); a[cnts++]=score[i]; } else { a[t]+=score[i]; } } ; int tid; ;i<cnts;i++) { if (ans<a[i]) { ans=a[i]; } } cnts=; ;i<n;i++) { int t=search(sname[i]); ) { strcpy(s[cnts],sname[i]); b[cnts++]=score[i]; ]>=ans && score[i]>=ans) { tid=i; break; } } else { b[t]+=score[i]; if (a[t]>=ans && b[t]>=ans) { tid=i; break; } } } printf("%s\n",sname[tid]); } int main() { while (scanf("%d",&n)!=EOF) slove(); ; }
//Accepted 200 KB 92 ms //模拟 //找到总分最大的 //若有多个总分最大的m,则找的第一个总分不少于m的总分最大的人 #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <cmath> #include <map> #include <algorithm> using namespace std; /** * This is a documentation comment block * 如果有一天你坚持不下去了,就想想你为什么走到这儿! * @authr songt */ map<string ,int > f,g; ; string s[imax_n]; int score[imax_n]; int n; void slove() { cin>>n; ; ;i<n;i++) { cin>>s[i]>>score[i]; f[s[i]]+=score[i]; } ;i<n;i++) { if (f[s[i]]>ans) ans=f[s[i]]; } //cout<<"ans="<<ans<<endl; int i; ;i<n;i++) { g[s[i]]+=score[i]; if (f[s[i]]>=ans && g[s[i]]>=ans) break; //cout<<"g[s[i]]="<<g[s[i]]<<endl; } //cout<<"i="<<i<<endl; cout<<s[i]<<endl; } int main() { slove(); ; }
cf--2A的更多相关文章
- Window8.1 64位无法使用Debug命令的解决方法[附牛人代码]
偶然看到网上一篇文章,讲的是世界黑客编程大赛第一名的一个很酷的程序,大小仅有4KB,使用debug命令执行. 悲催的是win8.1的debug命令不能使用. 错误例如以下: 解决方法例如以下: 1. ...
- <转载>Win x86-64 - Download & execute (Generator)
#Title: Obfuscated Shellcode Windows x86/x64 Download And Execute [Use PowerShell] - Generator #leng ...
- 2021 数字四川创新大赛WriteUp
数字四川初赛+复赛wp Web easyphp http://111.9.220.114:50006/.index.php.swp 备份文件泄漏 <?php #error_reporting(0 ...
- CF Gym 102028G Shortest Paths on Random Forests
CF Gym 102028G Shortest Paths on Random Forests 抄题解×1 蒯板子真jir舒服. 构造生成函数,\(F(n)\)表示\(n\)个点的森林数量(本题都用E ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- 红米2A高配刷机记录
2014816 机型:红米2A高配版 设备型号:2014816 CPU:高通 线刷:fastboot平台 http://192.168.7.118/MesReports/Reports/Cutting ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
随机推荐
- Material Design Button 样式
132down voteaccepted I will add my answer since I don't use any of the other answers provided. With ...
- dom4j解析xml作为测试数据
构造函数: public AppTestData(File xmlFile) throws Exception { file = xmlFile; try { saxReader = new SAXR ...
- 编译maxscale
编译maxscale,需要依赖mariadb版本的MySQL.有自己的版本就是任性啊
- OI中的代码调试
作为一位OIer,代码调试的能力必不可少. 今天梳理一下自己进行代码调试的方法,下面只是一些个人的总结. 代码的评价有三部分: 正确性 强健性 高效性 检查也应该从这三部分出发. [正确性] 打完代码 ...
- 【CITE】5个最优秀的Java和C#代码转换工具
毋庸置疑,Java是一门最受欢迎而且使用最广泛的编程语言,目前有超过9百万的Java开发者从事web服务的开发,Java以“编写一次,可在任何地方运行”而著称,同时这也是其大受欢迎的主要原因. 和Ja ...
- centos nginx 安装
1.下载 wget http://nginx.org/download/nginx-1.7.8.tar.gz 2.解压 tar -zxvf nginx-1.7.8.tar.gz 3.切换目录 cd n ...
- WLAN频段介绍-04
ISM频段 ISM频段,此频段主要是开放给工业.科学.医学三个主要机构使用,该频段是依据美国联邦通讯委员会(FCC)所定义出来,并没有所谓使用授权的限制. 工业频段:美国频段为902-928MHz,欧 ...
- centos7 学习
1.centos pid文件: 在Linux系统的目录/var/run下面一般我们都会看到很多的*.pid文件.而且往往新安装的程序在运行后也会在/var/run目录下面产生自己的pid文件.那么这些 ...
- hduoj-----(1068)Girls and Boys(二分匹配)
Girls and Boys Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- Trapping Rain Water [LeetCode]
Problem Description: http://oj.leetcode.com/problems/trapping-rain-water/ Basic idea: Get the index ...