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 ...
随机推荐
- Windows上使用Git管理文件
今天在搜索ffmpeg相关资料时,需要通过.sh脚本文件下载git上的代码文件,最后通过在Windows上安装了git,并在git.bash中执行bash ffmpeg.sh解决了代码下载问题,顺便学 ...
- JAVA遇上HTML-----JSP 篇基本概念
Java Web简介 1.什么是WEB应用程序: Web应用程序是一种可以通过Web访问的应用程序.Web应用程序的一个最大好处是用户很容易访问应用程序.用户只需要有浏览器即可,不需要再安装其他软件. ...
- react native的注释
在react native 中是这样写注释的: {/*这里是注释*/}
- Ng第十九课:总结(Conclusion)
19.1 总结和致谢 欢迎来到<机器学习>课的最后一段视频.我们已经一起学习很长一段时间了.在最后视频中,我想快速地回顾一下这门课的主要内容,然后简单说几句想说的话. 作为这门课的结束时 ...
- hibernate之查询
Query对象 方便的对数据库和持久化对象进行查询,两种表达方式:HQL和SQL; Query经常用来绑定查询参数,限制查询条数.并最终执行查询语句. HQL 查询一个简单类(查询所有) @Test ...
- noip第15课作业
1. 累加求和 给定n(1<=n<=100),用递归的方法计算1+2+3+4+5+......+(n-1)+n. 输入:一个大于等于1的整数. 输出:输出一个整数. [样例输入] 5 [样 ...
- output.php
<?php /** * */ class Output { function __construct() { $this->_zlib_oc = @ini_get('zlib.output ...
- JSON 全解
和js对象的区别 json只是一种数据格式,不支持undefined,字符串必须使用双引号,需要对/进行转义/. js属性名可不加"" json属性名必须加"" ...
- jQuery插件初级练习4
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- Amoeba常见问题
1.1.1 JAVA_HOME不认 jdk安装后测试无问题java –version,但启动amoeba就是报错JAVA_HOME找不到.就修改/amoeba/bin/amoeba文件,在文件最开头直 ...