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

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

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

不想写题意了,我想吐啊这题。。。没用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. 在java中String类为什么要设计成final?

    大神链接:在java中String类为什么要设计成final? - 程序员 - 知乎 我进行了重新排版,并且更换了其中的一个例子,让我们更好理解. String很多实用的特性,比如说“不可变性”,是工 ...

  2. Autolayout和VFL

    Autolayout,開始于iOS6.0   一.什么时候用autolayout比較适合   1.不负责任的骑墙派说法:apple的设备越来越多了,你的应用应该都使用al. (而且用sb)   2.要 ...

  3. viewcontroller生命周期知识要点

    一 viewcontroller执行方法的主要顺序为: init—>loadView—>viewDidLoad—>viewWillApper—>viewDidApper—> ...

  4. ftk学习记(combox篇)

    [声明:版权全部,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 上一篇文章谈到了多窗体,还是依照约定看一下效果是什么样的. 假设大家细心一点.就会发现窗体中的l ...

  5. Intel processor brand names-Xeon,Core,Pentium,Celeron----Celeron

    http://en.wikipedia.org/wiki/Celeron Celeron From Wikipedia, the free encyclopedia     Celeron Produ ...

  6. Mysql 数据库中间件

    读写分离:简单的说是把对数据库读和写的操作分开对应不同的数据库服务器,这样能有效地减轻数据库压力,也能减轻io压力.主数据库提供写操作,从数据库提供读操作,其实在很多系统中,主要是读的操作.当主数据库 ...

  7. MD5介绍及Windows下对文件做md5校验。

    MD5介绍参考百度百科: 摘要如下: MD5 校验和(checksum)通过对接收的传输数据执行散列运算来检查数据的正确性. 一个散列函数,比如 MD5,是一个将任意长度的数据字符串转化成短的固定长度 ...

  8. 一个动态库连续注册的windows脚本regsvr32

    cmd ->for %1 in (%windir%\system32\*.dll) do regsvr32.exe /s %1

  9. UVA - 11019 Matrix Matcher hash+KMP

    题目链接:传送门 题解: 枚举每一行,每一行当中连续的y个我们hash 出来 那么一行就是 m - y + 1个hash值,形成的一个新 矩阵 大小是 n*(m - y + 1), 我们要找到x*y这 ...

  10. 如何设计一个优秀的API

    如何设计一个优秀的API - 文章 - 伯乐在线 http://blog.jobbole.com/42317/ 如何设计一个优秀的API - 标点符 https://www.biaodianfu.co ...