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 ...
随机推荐
- 使用hibernate从一方获取多方信息时报错:org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role
引起原因:hibernate加载关联对象的方式有懒加载方式和立即加载方式. 如果在多对一的配置中没有指定加载方式,而一对多的配置中指定了懒加载方式,因此在获取一方是可获取到值,而获取多方时sessio ...
- SGU 271 Book Pile (双端队列)
题意:n,m,k,表示有一个长度为 n 的序列,有 m 个操作,操作有 2 种,第一种是 ADD 在前面添加一个串,第二种是把前 k 个进行翻转,问你最后的序列是什么样的. 析:很明显,如果直接模拟, ...
- HTMLDocument的变化
H5扩展了一些新的功能 1.readyState 属性的两个属性值 loading 正在加载文档 complete 已经加载完文档 可以根据对象的状态触动触发函数 2.兼容模式 IE6开始区分渲染页面 ...
- matlab画无向图,基于坐标的无向图联系作者
%函数名netplot %使用方法输入请help netplot %无返回值 %函数只能处理无向图 %作者:tiandsp %最后修改: function netplot(A,flag) %调用方法输 ...
- DDR中常用概念
一.DDR中的基本术语 (2)逻辑Bank SDRAM的内部是一个存储阵列,类似于一张表格.和表格的检索原理一样,先指定一个行(Row),再指定一个列(Column),就可以准确地找到所需要的单元格, ...
- Codeforces Round#412 Div.2
A. Is it rated? 题面 Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codefo ...
- Python自动化开发 - 装饰器
本节内容 一.装饰器导引 1.函数对象特性 2.扩展业务功能需求 3.各种解决方案 二.装饰器解析 1.装饰器基本概念 2.无参装饰器解析 一.装饰器导引 1.函数对象特性 #### 第一波 #### ...
- caffe 训练imagenet
1.整理得到自己的数据库,并生成自己数据库的列表文件.txt 2.将数据库转成lmbp格式 3.计算图像均值 4.修改网络参数 5.得到结果 1.整理得到自己的数据库 因为前面博文提到的原因,技术水平 ...
- RGB-D 室内导航 paper
摘要: 最近打算使用Kinect实现机器人的室内导航,收集了近年来的一些比较好的文章.<基于Kinect系统的场景建模与机器人自主导航>.<Mobile Robots Navigat ...
- Partition--使用分区切换来增加修改列的自增属性
使用分区来将非自增表改为自增表 ------------------------------------------------- --创建测试表TestTable001和TestTable002 C ...