传送门:

[http://codeforces.com/contest/1000/problem/A]

题意:

一个比赛颁奖,要准备T-Shirt给获奖者,但有的去年获奖过,衣服尺寸可以不改,有的需要修改,问需要修改几个尺寸

题解:

STL的应用,ma1先统计去年字符串出现的个数,然后输入今年字符串时如果去年不存在这种尺寸就要修改,

最后对比去年今年相同尺寸,如果去年比今年多,那么修改多出的那部分,并把今年这个尺寸数赋值为0,避免重复。

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
map<string,int> ma1,ma2;
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,i,sum=0;
string s[105];
string st;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>s[i];
ma1[s[i]]++;//统计字符串s[i]出现的个数
}
for(i=1;i<=n;i++)
{
cin>>st;
if(!ma1[st]) sum++;//如果去年不存在这种尺寸就要修改
else ma2[st]++;
}
for(i=1;i<=n;i++){
if(ma2[s[i]]-ma1[s[i]]>0) sum+=ma2[s[i]]-ma1[s[i]],ma2[s[i]]=0;
}
cout<<sum<<endl;
return 0;
}

1000/problem/A的更多相关文章

  1. hdu 4165 Pills dp

    Pills Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem De ...

  2. Ceres-Solver库入门

    示例1:求极值 首先我们以Ceres库官网中的Hello World例子来进行说明.这里例子的目的是为了计算方程取得最小值时x的值.从这个方程很容易看出来当x=10时,f(x)取得最小值0.这个方程虽 ...

  3. [ gczdac ] HDU1000

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=1000   Problem Description Calculate A + B.   Input Eac ...

  4. hdu 6301

    Distinct Values Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  5. 卡特兰数 HDU2067 & HDU4165 & HDU1134

    题目链接:https://vjudge.net/problem/HDU-2067 小兔的棋盘 Time Limit: 1000/1000 MS (Java/Others)    Memory Limi ...

  6. Educational Codeforces Round 46 (Rated for Div. 2) E. We Need More Bosses

    Bryce1010模板 http://codeforces.com/contest/1000/problem/E 题意: 给一个无向图,求图的最长直径. 思路:对无向图缩点以后,求图的最长直径 #in ...

  7. Topcoder SRM653div2

    A . 250 Problem Statement      Some people are sitting in a row. Each person came here from some cou ...

  8. BZOJ 1000: A+B Problem

    问题:A + B问题 描述:http://acm.wust.edu.cn/problem.php?id=1000&soj=0 代码示例: import java.util.Scanner; p ...

  9. 1000: A+B Problem(NetWork Flow)

    1000: A+B Problem Time Limit: 1 Sec  Memory Limit: 5 MBSubmit: 11814  Solved: 7318[Submit][Status][D ...

随机推荐

  1. [Hive_6] Hive 的内置函数应用

    0. 说明 Hive 的内置函数的基本操作 | 时间函数 | String 函数 | 条件语句 | explode | split | substring 1. 基本操作 查看函数 show func ...

  2. php笔记(一)php介绍及数据类型

    php 官方手册:http://php.net/manual/zh/ 1.PHP(全称 Hypertext Preprocessor,超文本预处理器的字母缩写)是一种服务器端脚本语言,它可嵌入到 HT ...

  3. February 19th, 2018 Week 8th Monday

    Love is blind, hard to find, difficult to get, and impossible to forget. 爱,很盲目,很难找,很难得,很难忘. It is al ...

  4. 【Linux基础】Linux更改系统IP

    1.SUSE系统 (1)设置IP cd /etc/sysconfig/network/ vi ifcfg-eth0 BOOTPROTO='static'   #静态IPBROADCAST='192.1 ...

  5. 监听器的配置,绑定HttpSessionListener监听器的使用

    监听器的配置,绑定 <listener> <listener-class>监听器的全路径</listener-class> </listener> Se ...

  6. (转)Spring Boot 2 (九):【重磅】Spring Boot 2.1.0 权威发布

    http://www.ityouknow.com/springboot/2018/11/03/spring-boot-2.1.html 如果这两天登录 https://start.spring.io/ ...

  7. nginx相关命令

    https://www.cnblogs.com/zdz8207/p/CentOS-nginx-yum.html

  8. jsp页面无法使用EL

    解决:http://blog.csdn.net/caixiexin/article/details/6958199 在web.xml中头部引入,2.3版本不支持EL,2.4默认开启,2.5默认关闭需要 ...

  9. centos7下安装docker(15.7容器跨主机网络---calico)

    Calico是一个纯三层的虚拟网络方案,Calico为每个容器分配一个IP,每个host都是router,把不同host的容器连接起来.与vxlan不同的是:calico不对数据包进行封装,不需要NA ...

  10. jenkins中布置python测试

    测试代码 #coding:utf- import unittest class MyTest(unittest.TestCase): # 继承unittest.TestCase def tearDow ...