POJ 2643
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#define MAXN 21
using namespace std;
struct cand_man
{
int num;
string name;
string party;
};
int compare(const void * i,const void * j);
cand_man man[MAXN]; int main()
{
// freopen("acm.acm","r",stdin);
int num_man;
int num_cast;
int pos;
string s;
int i;
int j;
cin>>num_man;
getchar();
for(i = ; i < num_man; ++ i)
{
getline(cin,man[i].name);
getline(cin,man[i].party);
}
cin>>num_cast;
getchar();
for(i = ; i < num_cast; ++ i)
{
getline(cin,s);
for(j = ; j < num_man; ++ j)
{
if(s == man[j].name)
{
++ man[j].num;
break;
}
}
}
qsort(man,num_man,sizeof(cand_man),compare);
if(man[].num == man[].num)
cout<<"tie"<<endl;
else
cout<<man[].party<<endl; }
int compare(const void * i,const void * j)
{
return *((int *)j) - *((int *)i);
}
POJ 2643的更多相关文章
- POJ 2643 Election map
POJ 2643 Election 第一次写博客,想通过写博客记录自己的ACM历程,也想解释下英文题目,写些自己的理解.也可以让自己以后找题目更加方便点嘛.ElectionTime Limit: 10 ...
- POJ 2643 Election
Election Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3558 Accepted: 1692 Descript ...
- poj 2284 That Nice Euler Circuit 解题报告
That Nice Euler Circuit Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 1975 Accepted ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
随机推荐
- 蓝绿部署、红黑部署、AB测试、灰度发布、金丝雀发布、滚动发布的概念与区别(转)
出处:https://www.baidu.com/link?url=QjboallwNm_jxcL3fHG57wEakiBfAs_3-TChTGu1eBXstlHEsGBc-NDA7AKTqsiroB ...
- springboot 碰到的问题
1.在springboot 启动报错 ** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentS ...
- 补全爬取的url
有时爬取到的href不全,如href=‘/11031/’解决方法:from urllib import parseurl=parse.urljoin(response.url,get_url)resp ...
- MySQL/Oracle视图的创建与使用
1.什么是视图? 视图是一个虚拟的表,是一个表中的数据经过某种筛选后的显示方式,视图由一个预定义的查询select语句组成. 2.视图的特点. 视图中的数据并不属于视图本身,而是属于基本的表,对视 ...
- div配景图片全div显示
<div class="face-boy" style="width:86px;height:92px;background: url('/${userProfil ...
- C# 编码标准(二)
先八卦一下,昨天写了C# 编码标准(一),得到了@h82258652的补充,感到非常欣慰,一是感觉他的观点扩展了我的视野,丰富了我的看法,所以更坚定了我继续写博客的想法,由于是五笔打字,经常不写东西, ...
- urb的处理流程
USB分析 2013年11月11日 16:06:24 阅读数:1807 转载自:http://blog.csdn.net/aaa6695798/article/details/4776202 很久 ...
- 快速创建一个 Servlet 项目(1)
1. 新建一个 maven project (web app) 得到如下项目 2. 添加 servlet 和 jsp 依赖 通常 servlet 和 jsp 依赖由web容器提供,这个编译错误并不会影 ...
- 2.1.6synchronized锁重入
关键字在使用synchronized时,当线程得到一个对象锁时,这时这个线程再次请求此对象锁是可以拿到的,也就说明同步方法之间是可以进行互相调用的, package com.cky.bean; /** ...
- android include使用[转]
需要包含的xml文件,我这里就放了一个Button按钮: btn.xml: <?xml version="1.0" encoding="utf-8"?&g ...