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 ...
随机推荐
- C# AOP框架入门(转)
出处:https://www.cnblogs.com/isaboy/p/Csharp_AOP_Log.html AOP面向切面编程(Aspect Oriented Programming),是通过预编 ...
- ACM-ICPC 2018 沈阳赛区网络预赛 B Call of Accepted(表达式求值)
题目链接:https://nanti.jisuanke.com/t/31443 相关前置链接 https://www.cnblogs.com/dolphin0520/p/3708602.html ht ...
- telegraph.conf配置
原文:http://www.cnblogs.com/smail-bao/p/7002361.html 1.操作系统基础监控指标配置标准 基础监控使用通用的全局配置文件telegraf.conf,以下只 ...
- Java四种排序:冒泡,选择,插入,二分(折半插入)
四种排序:冒泡,选择,插入,二分(折半插入) public class Test{ // public static void main(String[] args) { // Test t=new ...
- 开源javacsv读取csv文件
一.下载地址:https://sourceforge.net/projects/javacsv/ 读取示例: public static void main(String[] args) { // 1 ...
- TortoiseGit disconnected no supported authentication
从远程服务器上获取到的工程,用Git没问题,而TortoiseGit报错: Disconnected: No supported authentication methods available(se ...
- jquery中data()和js中dataset属性的区别
INTRO html的标签属性data-允许用户自定义属性.原生javascript和jquery分别定义了dataset属性和data()方法对标签中的data属性进行操作. 取值: 如我们定义这样 ...
- hdu 1716 排列
题目 这道题是全排列问题,主要注意的是格式问题.觉得下面这种写法最为巧妙 #include <cstdio> #include <iostream> #include < ...
- codeforces 879c
C. Short Program time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- hdu 5073 有坑+方差贪心
http://acm.hdu.edu.cn/showproblem.php?pid=5073 就是给你 n 个数,代表n个星球的位置,每一个星球的重量都为 1 开始的时候每一个星球都绕着质心转动,那么 ...