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

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

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

不想写题意了,我想吐啊这题。。。没用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. 2015 Multi-University Training Contest 3--1011 Work

    代码: #include<cstdio> #include<cstring> using namespace std; int n,k; int father[105],son ...

  2. C#语言 语句

    //有一组函数: //y=x(x<1) //y=2x-1(1<=x<10) //y=3x-11(x>=10) //括号内是x的满足条件 //实现功能,随意输出x /*Conso ...

  3. DBExecutor android 数据库框架

    https://github.com/eltld/DBExecutor android 数据库框架,sqlite database

  4. iGrimaceVX3.0和1.44在线源手机直接安装教程

    [第一步] 先安装好三个组件设备必须是苹果越狱好后 确定6点几跟7点几的版本号才干够 首先打开cydia 选开发人员 以下 点软件源 点右上角编辑  1加入源 apt.25pp.com和IG包下载源a ...

  5. 全志Android SDK编译详解(二)

    注意要确定安装了jdk) 第一步: cd  lichee; ./build.sh  -p sun5i_elite -k 3.0  (apt-get install uboot-mkimage需要安装m ...

  6. Ajax_HTTP请求以及响应

    什么是HTTP请求? 就是从用户的浏览器端向服务器端发送请求 一个HTTP请求一般由四个部分组成 1.HTTP请求的方法或者动作,比如GET或者POST请求 2.请求的URL,也就是请求的地址 3.请 ...

  7. 尝试使用UISearchDisplayController及对苹果对控件封装习惯的理解

    本文转载至 http://blog.sina.com.cn/s/blog_74e9d98d01019vji.html   在之前做过的应用中,很多都有“搜索”这个功能,大部分情况下我都是只采用UISe ...

  8. vmware nat不能上网的解决办法

    1 很多奇怪的问题都是vmware突然不能上网导致的 当yum.pip等包管理工具突然不能上网了时,要ping www.baidu.com,看看网络是不是好的. 2 nat网络出现问题的解决办法 2. ...

  9. poj 1821 Fence(单调队列优化DP)

    poj 1821 Fence \(solution:\) 这道题因为每一个粉刷的人都有一块"必刷的木板",所以可以预见我们的最终方案里的粉刷匠一定是按其必刷的木板的顺序排列的.这就 ...

  10. idea 破解注册方法总结

    注册码(无期限) JetbrainsCrack-2.6.2.jar适用于ideaIU-2017.2.之前版本,若版本较新适用 JetbrainsCrack-2.6.3_proc.jar. 其中Jetb ...