哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。。。。。。。

先让我笑完。。。。。。。。。。。。。。。。

就是一道撒比题啊,一开始是题目看错= =、是,但是后面还是自己不仔细错的。。。。。不存在题目坑这种情况。。。。。。。

不想写题意了,我想吐啊这题。。。没用map。。

就是n个操作好,然后求出一个最大值,然后满足这些最大值里面找一个最先的。。。。。。真的是撒比模拟,,,wa了那么久A掉也不怎么开心,自己好菜

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
#define LL long long
const double pi = acos(-1.0);
#define Len 200005
#define mod 19999997
const int INF = 0x3f3f3f3f;
#define exp 1e-6 struct asd{
char ss[1010];
int num;
}; asd q[1010];
asd qq[1010];
asd p[1010]; char s1[1010][1010];
char tep[1010]; int sum; int JUDGE(int x)
{
char ss[1010];
strcpy(ss,p[x].ss);
for(int i=0;i<sum;i++)
{
if(strcmp(ss,s1[i])==0)
return 1;
}
return 0;
} void debug()
{
for(int i=0;i<sum;i++)
printf("%s\n",s1[i]);
} int main()
{
int n;
int k,num,flag; cin>>n;
int Tmax;
Tmax=0;
num=0; for(int i=0;i<n;i++)
{
scanf("%s%d",&tep,&k); strcpy(qq[i].ss,tep);
qq[i].num=k; flag=0;
for(int j=0;j<num;j++)
{
if(strcmp(q[j].ss,tep)==0)
{
flag=1;
q[j].num+=k;
}
}
if(!flag)
{
strcpy(q[num].ss,tep);
q[num].num+=k;
num++;
}
}
Tmax=0;
for(int i=0;i<n;i++)
{
if(Tmax<q[i].num)
{
Tmax=q[i].num;
}
} //printf("%d\n",Tmax); sum=0;
for(int i=0;i<num;i++)
{
if(q[i].num==Tmax)
{
strcpy(s1[sum++],q[i].ss);
}
} //debug(); num=0;
for(int i=0;i<n;i++)
{
strcpy(tep,qq[i].ss);
k=qq[i].num; flag=0;
for(int j=0;j<num;j++)
{
if(strcmp(tep,p[j].ss)==0)
{
p[j].num+=k;
if(p[j].num>=Tmax&&JUDGE(j))
{
printf("%s",p[j].ss);
return 0;
}
flag=1;
}
}
if(!flag)
{
strcpy(p[num].ss,tep);
p[num].num=k;
if(p[num].num>=Tmax&&JUDGE(num))
{
printf("%s",p[num].ss);
return 0;
}
num++;
}
}
return 0;
} /* 6
andrew 3
andrew 2
andrew 2
andrew 3
mike 5
mike 5 */

Codeforces 2 A. Winner的更多相关文章

  1. Codeforces 2A :winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  2. codeforces 2A Winner (好好学习英语)

    Winner 题目链接:http://codeforces.com/contest/2/problem/A ——每天在线,欢迎留言谈论. 题目大意: 最后结果的最高分 maxscore.在最后分数都为 ...

  3. CodeForces 2A - Winner(模拟)

    题目链接:http://codeforces.com/problemset/problem/2/A A. Winner time limit per test 1 second memory limi ...

  4. CodeForces 2A Winner

    Winner Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  5. Codeforces Beta Round #2 A. Winner 水题

    A. Winner 题目连接: http://www.codeforces.com/contest/2/problem/A Description The winner of the card gam ...

  6. Codeforces Beta Round #2 A. Winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  7. codeforces Winner

    /* * Winner.cpp * * Created on: 2013-10-13 * Author: wangzhu */ /** * 先找出所有选手的分数和中最大的分数和,之后在所有选手的分数和 ...

  8. Codeforces Gym100952 A.Who is the winner? (2015 HIAST Collegiate Programming Contest)

      A. Who is the winner?   time limit per test 1 second memory limit per test 64 megabytes input stan ...

  9. Codeforces Round #603 (Div. 2) C. Everyone is a Winner! 二分

    C. Everyone is a Winner! On the well-known testing system MathForces, a draw of n rating units is ar ...

随机推荐

  1. weex 项目开发(四)项目框架搭建 及 自定义 TabBar 组件

    1.安装  路由模块  及  状态管理模块 npm install vue-router --save npm install vuex --save 2.自定义  TabBar  组件 src / ...

  2. Yii框架中安装srbac扩展方法

    首先,下载srbac_1.3beta.zip文件和对应的blog-srbac_1.2_r228.zip 问什么要下载第二个文件,后面就知道了. 按照手册进行配置: 解压缩srbac_1.3beta.z ...

  3. 【转载】TCP粘包问题分析和解决(全)

    TCP通信粘包问题分析和解决(全) 在socket网络程序中,TCP和UDP分别是面向连接和非面向连接的.因此TCP的socket编程,收发两端(客户端和服务器端)都要有成对的socket,因此,发送 ...

  4. vc6.0的一些快捷键

    1.检测程序中的括号是否匹配    把光标移动到需要检测的括号(如大括号{}.方括号[].圆括号()和尖括号<>)前面,键入快捷键“Ctrl+]”.如果括号匹配正确,光标就跳到匹配的括号处 ...

  5. eclipse debug configurations arguments指定文件路径参数

    1 eclipse debug configurations arguments指定文件路径参数 使用绝对路径,但是这个文件必须要放在该project的源码路径的外面才行,否则eclipse不认这个文 ...

  6. JS中使用组合构造函数模式和原型模式

    创建自定义类型的最常见方式,就是组合使用构造函数模式与原型模式.构造函数模式用于定义实例属性,而原型模式用于定义方法和共享的属性. 结果,每个实例都会有自己的一份实例属性的副本,但同时又共享着对方法的 ...

  7. gravity layout_gravity

    gravity:控制当前视图的内容/子view layout_gravity:控制视图本身

  8. 动态预览Xib的实现

    写一个TestView继承于UIView,然后写个对应的xib,把xib的名字设置成TestView,这是标准的用xib加载这个view必须得条件 然后xib里把这个View的backgroundCo ...

  9. html5--6-3 CSS语法2

    html5--6-3 CSS语法2 实例 div包含p和h标签的时候可以,但是p标签包含h标签的时候不可以  学习要点 掌握引入外部样式表方法 插入样式的三种方法 内联样式表(行内) 内部样式表(st ...

  10. codeforces 690C1 C1. Brain Network (easy)(水题)

    题目链接: C1. Brain Network (easy) time limit per test 2 seconds memory limit per test 256 megabytes inp ...