题目描述:
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn’t take a leaf if it matches the color and the species of the tree of one of the leaves she already has. Find out how many leaves Alyona has picked.
输入描述:
The first line contains an integer n (1 ≤ n ≤ 100) — the number of leaves Alyona has found. The next n lines contain the leaves’ descriptions. Each leaf is characterized by the species of the tree it has fallen from and by the color. The species of the trees and colors are given in names, consisting of no more than 10 lowercase Latin letters. A name can not be an empty string. The species of a tree and the color are given in each line separated by a space.
输出描述:
Output the single number — the number of Alyona’s leaves.
输入:
5
birch yellow
maple red
birch yellow
maple yellow
maple green
3
oak yellow
oak yellow
oak yellow
输出:
4
1
题意:
找不同树叶的数目
题解
getline读一行,把输入当成一个字符串,直接set搞一下就好了
代码:

#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<set>
using namespace std;int main(){int n;string name;while(scanf("%d",&n)!=EOF){getchar();set<string>st;st.clear();for(int i = 1; i <= n; i ++){getline(cin,name);st.insert(name);}printf("%d\n",st.size());}return 0;
}

Codeforces--44A--Indian Summer相关推荐

  1. 浙南联合训练赛20180414

    这次题目的代码都不长,CF的一贯风格 A - Game CodeForces - 513A Two players play a simple game. Each player is provide ...

  2. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  3. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

  4. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  5. CodeForces 获得数据

    针对程序的输出可以看见 CodeForces :当输入.输出超过一定字符,会隐藏内容 所以:分若干个程序进行输入数据的获取 1. 1 for (i=1;i<=q;i++) 2 { 3 scanf ...

  6. codeforces水题100道 第二十七题 Codeforces Round #172 (Div. 2) A. Word Capitalization (strings)...

    题目链接:http://www.codeforces.com/problemset/problem/281/A 题意:将一个英文字母的首字母变成大写,然后输出. C++代码: #include < ...

  7. CodeForces 595A

    题目链接: http://codeforces.com/problemset/problem/595/A 题意: 一栋楼,有n层,每层有m户,每户有2个窗户,问这栋楼还有多少户没有睡觉(只要一个窗户灯 ...

  8. codeforces A. Jeff and Digits 解题报告

    题目链接:http://codeforces.com/problemset/problem/352/A 题目意思:给定一个只有0或5组成的序列,你要重新编排这个序列(当然你可以不取尽这些数字),使得这 ...

  9. Codeforces Round #506 (Div. 3)

    Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...

  10. Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈)

    Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈) 标签: codeforces 2017-06-02 11:41 29人阅读 ...

最新文章

  1. 剑指offer_第8题_跳台阶
  2. 17 Java面试之css
  3. Spring Boot 参考指南(使用NoSQL技术)
  4. 宁波大学计算机网络实验五,宁波大学计算机网络实验四.doc
  5. PythonTips1
  6. MySql安全模式下修改root账号密码
  7. FineUI.Grid内容换行处理
  8. Lync Server 2010下载拓扑报错分析及解决方法分享
  9. 约当标准型_约当标准型.ppt
  10. PL/SQL 工具远程连接Oracle数据库方法,plsql免安装oracle客户端直接配置oci实战演示
  11. MATLAB线形规划函数linprog、intlinprog与二次规划函数quadprog
  12. Lasso回归理论及代码实现
  13. 微信公众号测试账号网址
  14. uCOSIII移植stm32c8t6
  15. 用python读取股票基本信息_python-使用pandas datareader获取股票信息
  16. 计算机指令exec,2.1.3 使用jexec工具管理jail虚拟机
  17. 带上紧箍咒,特斯拉辅助驾驶系统即将更新
  18. office被wps捆绑,wps删不干净,word等文件打开始终默认为wps怎么办
  19. 解决ORA-00257:archiver error.Connect internal only, until freed
  20. aspose-words基本操作

热门文章

  1. Nginx+Tomcat实现负载均衡与动静分离
  2. MBA不修“内功”,智能音箱犯后遗症
  3. javascript动画制作
  4. 17.文件系统磁盘配额
  5. HDU 2020 多校第二场 游记
  6. Delphi 通用程序全屏设计
  7. .net(C#) json 大驼峰、小驼峰,命名混用
  8. 新手必须掌握的20个摄影构图法 转
  9. JPA使用过程中遇到的问题
  10. Detail information about Withholding Tax in SAP