zoukankan      html  css  js  c++  java
  • 【牛客】牛客小白月赛2 C题(对string[]的操作)

    C   真真假假 

    https://www.nowcoder.com/acm/contest/86/C

    算卦先生来问你,对于每个他给出的 C++ 头文件,请告诉他是否存在。
    头文件列表:algorithm, bitset, cctype, cerrno, clocale, cmath, complex, cstdio, cstdlib, cstring, ctime, deque, exception, fstream, functional, limits, list, map, iomanip, ios, iosfwd, iostream, istream, ostream, queue, set, sstream, stack, stdexcept, streambuf, string, utility, vector, cwchar, cwctype
     
    思路:建立string[]数组,把这些都存进去,判断的时候for里的条件可以写成for(int i=0;str[i].size();i++)
    #include<iostream>
    #include<algorithm>
    using namespace std;
    typedef long long LL;
     
    const int MAX_N=1005;
    int n,T;
    LL a[MAX_N];
    string str[100]={
    "algorithm", "bitset", "cctype", "cerrno", "clocale","cmath" , "complex","cstdio", "cstdlib",
    "cstring", "ctime", "deque", "exception", "fstream", "functional", "limits", "list",
     "map", "iomanip", "ios", "iosfwd","iostream" , "istream", "ostream", "queue", "set",
     "sstream", "stack","stdexcept" , "streambuf", "string", "utility", "vector", "cwchar", "cwctype"};
     
    int main()
    {
        ios::sync_with_stdio(false);
        cin>>n;
        string ans="Kun",ss;
        for(int i=0;i<n;++i)
        {
            cin>>ss;
            ans="Kun";
            for(int i=0;str[i].size();++i)
                if(str[i]==ss){
                    ans="Qian"; break;
                }
            cout<<ans<<endl;
        }
        return 0;
    }
  • 相关阅读:
    Linux 环境变量 设置 etc profile
    Linux 升级glibc-2.14 失败 我遇到的问题
    qt窗口的切换
    qt事件机制---事件范例
    qt中的事件机制
    qt的信号与槽函数
    linux下qt的安装
    qt中的udp编程
    qt中的tcp编程
    qt中的多线程
  • 原文地址:https://www.cnblogs.com/Kohinur/p/8908789.html
Copyright © 2011-2022 走看看