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 ...
随机推荐
- 5-2-2 printf参数从右往左压栈
5-2-2 C中printf计算参数时是从右到左压栈的 #include <stdio.h> int main (int argc, char **argv) { ; ,,,,}; int ...
- xcode6 framework missing submodule xxx 警告
xcode6 framework missing submodule xxx 警告 从xcode6开始,iOS可以直接创建生成framework了 如: 创建 framework 项目,TFKit.f ...
- 高可用性中的脑裂问题(split-brain problem in HA)(转)
欢迎关注我的社交账号: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://gith ...
- 【hdu2196】Computer
hdu 2196 computer 题意 给你一棵树,边有权值. 对于每一个点,求其与其距离最远的点的距离. 分析 思路1:树的直径 利用直径的性质进行求解,网上资料很多,这里不赘述. #includ ...
- 设置pictureBox的边框颜色
private void pictureBox2_Paint(object sender, PaintEventArgs e) { PictureBox p = (PictureBox)sender; ...
- css清除默认样式和设置公共样式
/*公共样式--开始*/ html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dl, dt, dd, ol, form, input, textar ...
- Python中pip版本升级error:You are using pip version 7.1.2, however version 8.1.1 is available.
使用pip install安装命令时,会报错:You are using pip version 7.1.2, however version 8.1.1 is available. 尝试了推荐解决办 ...
- wordpress内存不足问题“Fatal error:out of memoryin etc...”
2016年3月22日wordpress用户名及密码登录,出现: “ Fatal error: Out of memory (allocated 19136512) (tried to allocate ...
- 35 个免费创新的响应式 HTML5 模板
HTML5 和响应式都是 Web 开发领域中的热门技术,本文向你推荐 35 个免费的响应式 HTML5 模板,将两种技术完美结合. Mori responsive HTML5 Template Res ...
- 《转》---使用递归方法DataTable 绑定 TreeView
转自:http://blog.sina.com.cn/s/blog_8944756d01016yaj.html 前台: <asp:View ID="view0" runat= ...