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

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

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

不想写题意了,我想吐啊这题。。。没用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. BubbleGum96 开箱杂谈与软件资源

    前言 原创文章,转载引用务必注明链接. 拿到有一段时间了,一直在想写哪些内容.96boards发布以来,吸引了很多眼球.这里我就慢慢随便聊聊,希望能让大家对96boards有更多了解. 开箱 [开箱图 ...

  2. Intel Edison —— 控制GPIO接口,网页显示传感器数值

    前言 原创文章,转载引用务必注明链接. 因为是使用Typora(markdown)写好然后复制到论坛的,推荐直接访问我的网站以获得更好地阅读体验. Intel XDK IoT 开发环境很久之前就上手了 ...

  3. JavaScript - 正则表达式解惑

    正则表达式手册: http://tool.oschina.net/uploads/apidocs/jquery/regexp.html 正则表达式测试地址: http://tool.chinaz.co ...

  4. HDOJ How many ways?? 2157【矩阵高速幂】

    How many ways? ? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. C语言语句

    /*Console.Write("你能跑得过豹子吗,请输入 能/不能:"); string a = Console.ReadLine();//接收所输入的字符串内容, if (a= ...

  6. 读写锁(pthread)

    读写锁: 用于对于某个给定资源的共享访问,而不是像互斥锁那样,将所有试图进入临界区的线程都阻塞住 相关内容: 线程互斥锁 分配规则:(写独占,读共享) 1.只要没有线程持有某个给定的读写锁用于写,那么 ...

  7. System V IPC相关函数

    System V IPC 将一个已保存的路径名和一个整数标识符转换成一个key_t值,称为IPC键key_t:System V IPC(System V消息队列.System V信号量.System ...

  8. 全卷积神经网络FCN理解

    论文地址:https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf 这篇论文使用全卷积神经网络来做语义上的图像分割,开创了这一领 ...

  9. 【Android】Android聊天机器人实现

    昨天看到一个Android视频教程讲图灵机器人.那个API接口用起来还是挺方便的,就准备自己动手做一个了. 另外自己还使用了高德地图的API接口用于定位(曾经用过高德的接口,比X度方便) 大体流程: ...

  10. 通过命令打包apk

    平时使用android studio打包,方便快捷,对命令不太熟悉,但在上传apk包到应用市场时,需要认领apk,“认领页的[选择APK]”不是上传您要更新的APK应用文件,而是下载我们提供的空包文件 ...