题目链接: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. Quick solution to java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices error

    In case if you face this problem, one of the possible solutions that will work for you is to make su ...

  2. 使用redis镜像

    运行容器 runoob@runoob:~/redis$ docker run -p : -v $PWD/data:/data -d redis:3.2 redis-server --appendonl ...

  3. unity3d 调用Start 注意

    在unity3d中,同一个脚本被绑定到多个物体上的时候,只有active的物体才会调用void Start ()  方法, 如果物体是NO Active 的状态,则不会调用Start,Awake也不会 ...

  4. 利用POST重启路由器,一直无法实现,求帮助

    本帖最后由 xinaini1986 于 2014-10-20 13:03 编辑 因为路由器经常会无法上网,重启一下路由器就可以,但每次都登陆路由器管理重启路由器很麻烦,所以想通过按键精灵POST方式重 ...

  5. 彻底搞清楚Java并发 (一) 基础

    多线程编程是为了让程序运行得更快,但是不是说,线程创建地越多越好,线程切换的时候上下文切换,以及受限于硬件和软件资源的限制问题 上下文切换 单核CPU同样支持多线程编程,CPU通过给每个线程分配CPU ...

  6. Django系列之form渲染表单后css样式丢失

    最通用的form写法 我们经常看各大网站上写这样的form写法 class SYSAdminPhysicalForm(forms.ModelForm): ''' this form for idc's ...

  7. 复制js的“准”正确用法

    function kobe(id)      {           var targetText = document.getElementById(id);          try        ...

  8. smartgit 需要输入序列号解决办法

    找到路径: %APPDATA%\syntevo\SmartGit\<main-smartgit-version> 然后删除: settings.xml 再重新打开smartgit 就可以了

  9. 5种实现垂直居中css

    摘要: 在我们制作页面的时候经常会遇到内容垂直居中的需求,今天分享5种垂直居中的方法,每种方法都有自己的优缺点,可以选择自己喜欢的方式.以下代码都经过本人亲自测试. line-height: < ...

  10. Git------创建本地库时绿色标志不显示

    转载: http://blog.csdn.net/zixiao217/article/details/77018392 解决方法: 按Win+R键打开运行对话框,输入 regedit.exe ,准备修 ...