zoukankan      html  css  js  c++  java
  • 2017网易校招真题 下厨房

    时间限制:1秒 空间限制:32768K 热度指数:18523

     算法知识视频讲解

    题目描述

    牛牛想尝试一些新的料理,每个料理需要一些不同的材料,问完成所有的料理需要准备多少种不同的材料。

    输入描述:

    每个输入包含 1 个测试用例。每个测试用例的第 i 行,表示完成第 i 件料理需要哪些材料,各个材料用空格隔开,输入只包含大写英文字母和空格,输入文件不超过 50 行,每一行不超过 50 个字符。

    输出描述:

    输出一行一个数字表示完成所有料理需要多少种不同的材料。
    示例1

    输入

    BUTTER FLOUR HONEY FLOUR EGG

    输出

    4
    思路:水题,set搞一下就好。
    #include<set>
    #include<cstdio>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    set<string>se;
    char s[52];
    int ans;
    int main(){
        while(scanf("%s",&s)!=EOF){
            if(s[0]!='
    ')
                if(se.find(s)==se.end()){
                    se.insert(s);
                    ans++;
                }
        }
        cout<<ans;
    }


    细雨斜风作晓寒。淡烟疏柳媚晴滩。入淮清洛渐漫漫。 雪沫乳花浮午盏,蓼茸蒿笋试春盘。人间有味是清欢。
  • 相关阅读:
    ubutu16.04编译安装apache
    python格式化字符串
    git服务器搭建
    merge into 导致序列跳号
    Apache 强制SSL访问
    pyhton之解析html的表格
    Two modules in a project cannot share the same content root报错解决方案
    hdoj
    hdoj
    QHUOJ
  • 原文地址:https://www.cnblogs.com/cangT-Tlan/p/7670950.html
Copyright © 2011-2022 走看看