zoukankan      html  css  js  c++  java
  • 【[Offer收割]编程练习赛13 A】风格不统一如何写程序

    【题目链接】:http://hihocoder.com/problemset/problem/1501

    【题意】

    【题解】

    模拟题

    【Number Of WA

    1

    【完整代码】

    #include <bits/stdc++.h>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define ps push_back
    #define fi first
    #define se second
    #define rei(x) scanf("%d",&x)
    #define rel(x) scanf("%lld",&x)
    #define ref(x) scanf("%lf",&x)
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 110;
    
    int n;
    char s[200];
    
    int main()
    {
        //freopen("F:\rush.txt","r",stdin);
        rei(n);
        rep1(i,1,n)
        {
            scanf("%s",s+1);
            int len = strlen(s+1);
            rep1(j,1,len)
                if (s[j]=='_')
                {
                    if (j+1<=len)
                        s[j+1]=s[j+1]-'a'+'A';
                    continue;
                }
                else
                    if (s[j-1]!='_' && s[j]>='A'&&s[j]<='Z')
                    {
                        putchar('_');
                        putchar(s[j]-'A'+'a');
                    }
                    else
                        putchar(s[j]);
            puts("");
        }
        //printf("
    %.2lf sec 
    ", (double)clock() / CLOCKS_PER_SEC);
        return 0;
    }
    
  • 相关阅读:
    python
    图片放大,缩小等操作
    template-web.js 自定义过滤器
    python
    python
    Android Volley源码分析及扩展
    Android 6.0动态权限申请教程
    Jarsigner签名使用
    Python正则表达式(总)
    Python错误和异常概念(总)
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626464.html
Copyright © 2011-2022 走看看