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的超简练代码后的感悟,努力追之。

  • 相关阅读:
    [转]script之defer&async
    css3渐变gradient
    [转]提高 web 应用性能之 CSS 性能调优
    [转]深入了解 CSS3 新特性
    进程中t.start(), t.daemon() t.jion()的使用
    创建进程
    进程与进程之间通信Manager
    简版线程池
    Python上下文管理
    绝版线程池
  • 原文地址:https://www.cnblogs.com/moonbay/p/4370569.html
Copyright © 2011-2022 走看看