zoukankan      html  css  js  c++  java
  • bjfu1299 stl使用

    题目超简单,我写解题报告是因为我的代码用了些STL,使代码很简洁。

    *
     * Author    : ben
     */
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <set>
    #include <map>
    #include <stack>
    #include <string>
    #include <vector>
    #include <deque>
    #include <list>
    #include <functional>
    #include <numeric>
    #include <cctype>
    using namespace std;
    inline bool isletter(char c) {
        return !isalpha(c) && c != 0;
    }
    
    int main() {
        int T, cn;
        char str[100];
        scanf("%d", &T);
        for (int t = 1; t <= T; t++) {
            scanf("%s", str);
            remove_if(str, str + strlen(str) + 1, isletter);
            transform(str, str + strlen(str), str, ::tolower);//加::是为防止重载的函数冲突,有别的写法
            str[0] = toupper(str[0]);
            printf("Case #%d: %s
    ", t, str);
        }
        return 0;
    }

    看起来有点像装b,其实真不是。stl用熟以后真能很省代码,这是我11年看到大神watashi的超简练代码后的感悟,努力追之。

  • 相关阅读:
    进程 之二
    进程
    VIM
    Linux
    编码
    Maven
    Java
    Java
    Java
    其他
  • 原文地址:https://www.cnblogs.com/moonbay/p/4370569.html
Copyright © 2011-2022 走看看