题目链接:http://www.codeforces.com/problemset/problem/131/A
题意:字符串大小写转换。
C++代码:

#include <cstdio>
#include <cstring>
char s[];
bool islow(char c)
{
return c >= 'a' && c <= 'z';
}
char up(char c)
{
return c - ;
}
char low(char c)
{
return c + ;
}
bool check()
{
char *t = s;
t ++;
while (*t)
{
if (islow(*t))
return true;
t ++;
}
return false;
}
int main()
{
scanf("%s", s);
if (check())
{
puts(s);
}
else
{
char *t = s;
while (*t)
{
if (islow(*t))
putchar(up(*t));
else
putchar(low(*t));
t ++;
}
}
return ;
}

C++

codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)的更多相关文章

  1. codeforces水题100道 第二十五题 Codeforces Round #197 A. Helpful Maths (Div. 2) (strings)

    题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include ...

  2. codeforces水题100道 第二十四题 Codeforces Beta Round #85 (Div. 2 Only) A. Petya and Strings (strings)

    题目链接:http://www.codeforces.com/problemset/problem/112/A题意:忽略大小写,比较两个字符串字典序大小.C++代码: #include <cst ...

  3. codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)

    题目链接:http://www.codeforces.com/problemset/problem/118/A题意:字符串转换……C++代码: #include <string> #inc ...

  4. codeforces水题100道 第十六题 Codeforces Round #164 (Div. 2) A. Games (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/268/A题意:足球比赛中如果主场球队的主场球衣和客队的客队球衣颜色一样,那么要求主队穿上他们的可对 ...

  5. codeforces水题100道 第二十题 Codeforces Round #191 (Div. 2) A. Flipping Game (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/327/A题意:你现在有n张牌,这些派一面是0,另一面是1.编号从1到n,你需要翻转[i,j]区间的 ...

  6. codeforces水题100道 第十九题 Codeforces Round #109 (Div. 2) A. I_love_%username% (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/155/A题意:找到当前最大值或者最小值出现的次数.“当前”的意思差不多是a[i]大于所有a[j]( ...

  7. codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...

  8. codeforces水题100道 第十五题 Codeforces Round #262 (Div. 2) A. Vasya and Socks (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/460/A题意:Vasya每天用掉一双袜子,她妈妈每m天给他送一双袜子,Vasya一开始有n双袜子, ...

  9. codeforces水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...

随机推荐

  1. Python之从numpy.array保存图片

    1.用scipy import scipy scipy.misc.imsave('test.jpg', img) 2.用PIL from PIL import Image im = Image.fro ...

  2. Relu的理解

    ReLU上的花样 CNN出现以来,感觉在各个地方,即便是非常小的地方都有点可以挖掘.比如ReLU. ReLU的有效性体现在两个方面: 克服梯度消失的问题 加快训练速度 而这两个方面是相辅相成的,因为克 ...

  3. swing包含了各种组件的类

    javax.swing 最常用的pachage,包含了各种swing组件的类 javax.swing.border 包含与swing组件外框有关的类 javax..swing.colorchooser ...

  4. js 报错检查顺序

    如上图所示错误列表: 处理步骤:检查顺序应从最后到前,并且先检查当面页面引用的文件(公共引用文件一般不会出错的) 如:at.nt.query方法检查错误开始 倒推

  5. Mongodb学习笔记(2)--修改器

    修改器 利用原子的更新修改器,可以使得这种部分更新极为高效,更新修改器是一种特殊的键,用来指定复杂的更新操作,比如调整,增加或删除,还可以操作数组或内嵌文档. $inc $inc修改器用来增加已有键的 ...

  6. Android OpenGL ES 离屏渲染(offscreen render)

    通常在Android上使用OpenGL ES,都是希望把渲染后的结果显示在屏幕上,例如图片处理.模型显示等.这种情况下,只需要使用Android API中提供的GLSurfaceView类和Rende ...

  7. UNIX环境编程学习笔记(20)——进程管理之exec 函数族

    lienhua342014-10-07 在文档“进程控制三部曲”中,我们提到 fork 函数创建子进程之后,通常都会调用 exec 函数来执行一个新程序.调用 exec 函数之后,该进程就将执行的程序 ...

  8. sar监控工具详解

    转自http://www.cnblogs.com/Amaranthus/p/3745680.html SAR NAME: SAR报告,收集,保存系统活动信息 语法: sar  [ -A ] [ -b ...

  9. 【NLP】Stanford

    http://web.stanford.edu/class/cs224n/syllabus.html https://www.youtube.com/watch?v=OQQ-W_63UgQ&l ...

  10. Asp.net mvc怎么在razor里写js代码

    我试图在Razor里写JS代码,但是不行 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3 ...