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 ...
随机推荐
- centos7 修改selinux 开机导致 faild to load SELinux policy freezing 错误
centos7 修改selinux 开机导致 faild to load SELinux policy freezing 错误 之前把selinux关闭了,这次想打开selinux,于是修改了 /e ...
- table合并单元格colspan和rowspan .
colspan和rowspan这两个属性用于创建特殊的表格. colspan是“column span(跨列)”的缩写.colspan属性用在td标签中,用来指定单元格横向跨越的列数: 在浏览器中将显 ...
- Cache模拟器(CacheSim)
最近写了一个Cache的模拟器,由于平时空余时间比较分散,前前后后用了一周多的时间,基本实现的Cache的模拟功能(通过读取trace文件得到相应的命中率),能够实现直接映射.全相联.组相联三种 ...
- require.js学习笔记(内容属于转载总结)
<script data-main="src/app" src="src/lib/require.js"></script> backb ...
- 百度地图API首页 -- 鼠标经过:类似翻页效果和 类似锚点链接效果
var timer; $("li").on("mouseover",function(){ clearTimeout(timer); timer=null; $ ...
- JavaWeb基础: Tomcat
Tomcat目录层次结构 Tomcat本质上是一个Java应用,要启动Tomcat服务需要安装JRE并配置JRE的Path,才能通过Tomcat_HOME/bin/startup脚本正常启动Tomca ...
- S2 第三章SQL编程
.if练习 --统计并显示2013-- 的oop考试平均分 --如果平均分在70以上,显示“考试成绩优秀”,并显示前三名学生的考试信息 --如果在70分以下,显示“考试成绩较差”,并显示后三名学生的考 ...
- listview加载性能优化ViewHolder
在android开发中Listview是一个很重要的组件,它以列表的形式根据数据的长自适应展示具体内容,用户可以自由的定义listview每一列的布局, 但当listview有大量的数据需要加载的时候 ...
- [转]CentOS更改yum源与更新系统
[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cent ...
- php 5.5.1 编译安装过程
1.下载解压 wget http://au1.php.net/get/php-5.5.1.tar.gz/from/ch2.php.net/mirror tar zxvf php-5.5.1.tar.g ...