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 ...
随机推荐
- graph-tool文档(一)- 快速开始使用Graph-tool - 2.属性映射、图的IO和Price网络
目录: 属性映射 -- 内部属性映射 图的I/O 构建一个 Price网络(例) 名词解释: Property maps:属性映射 PropertyMap:一个类 scalar value types ...
- Spring3.1新特性
一.Spring2.5之前,我们都是通过实现Controller接口或其实现来定义我们的处理器类. 二.Spring2.5引入注解式处理器支持,通过@Controller 和 @RequestMa ...
- 扒一扒JavaScript 预解释
带var关键字预解释 让我们先看下这段代码执行的结果: 代码如下: alert(n);//弹出undefinedvar n = 10; 弹出的结果是undefined,为何不是10?让我们再看下面这段 ...
- python 练习 8
#!/usr/bin/python # -*- coding: utf-8 -*- def ntom(x,size,mod): t=[0]*(size) j=0 while x and j<si ...
- .NET Reflector 8.2支持VS2013高亮显示和代码地图视图
Red Gate Software公司最近发布的.NET Reflector 8.2支持Visual Studio 2013,其Reflector 桌面程序能够转换十六进制/十进制值.桌面程序还支持局 ...
- java synchronized静态同步方法与非静态同步方法,同步语句块
摘自:http://topmanopensource.iteye.com/blog/1738178 进行多线程编程,同步控制是非常重要的,而同步控制就涉及到了锁. 对代码进行同步控制我们可以选择同步方 ...
- JAVA类与对象作业——动手动脑以及课后实验性问题
一: 1.源代码 //MAO2015.10.6 //foo class Foo { int value; public Foo(int initValue) { value = initValue; ...
- WPF:行列显示
新建显示病人信息控件PatientElement Add-->NewItem-->WPF-->UserControl(WPF),名称:PatientElement.xmal < ...
- 张艾迪(创始人):拥抱单身与自由的Eidyzhang
拥抱单身与自由(Single+Freedom) 拥抱伟大的梦想与理想.年轻一代的张扬与自信 拥抱AOOOiA.Global.224C的一切是我对这个世界的态度 +AOOOiA.Global.224C创 ...
- spring3表达式语言(SpEL)
使用SpEl进行表达式操作,基本操作如下: <!--第一步,构建解析 --> ExpressionParser parser = new SpelExpressionParser(); & ...