题目链接: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. mxnet与tensorflow的卷积实现细节比较

    mxnet的卷积 kernel = 3  pad=1边界补充0后,不管stride是否1还是2,imgw = 奇数或者偶数, 都是从图像位置(0,0)开始卷积 tensorlfow的卷积 kernel ...

  2. (笔记)Linux 如何查看线程数最佳解决方案

    背景:很多学linux的人都会使用ps查看进程状态,却一直不清楚如何查看线程的状态. 方法:可使用ps -a 或 ps -T命令查看 一.使用ps -a命令查看 比如拿我的测试进程./lc300-le ...

  3. python 调用 C语言函数

    python可以直接调用C语言的函数,本文记录用ctypes调用c语言的方法. test.c #include <stdio.h> int test(char *temp) { print ...

  4. Spring Data Commons 官方文档学习

    Spring Data Commons 官方文档学习   -by LarryZeal Version 1.12.6.Release, 2017-07-27 为知笔记版本在这里,带格式. Table o ...

  5. AWT控件称为重量级控件

    AWT 是Abstract Window ToolKit (抽象窗口工具包)的缩写,这个工具包提供了一套与本地图形界面进行交互的接口. AWT 中的图形函数与操作系统所提供的图形函数之间有着一一对应的 ...

  6. Windows错误码大全

    0000 操作已成功完成.0001 错误的函数.0002 系统找不到指定的文件.0003 系统找不到指定的路径.0004 系统无法打开文件.0005 拒绝访问.0006 句柄无效.0007 存储区控制 ...

  7. C# 窗口自适应窗口宽度和高度

    其实winform并不适合做自适应这玩意的,虽然,能做是能做, 就像菜刀一样能切水果,但是,不是那么合适,毕竟有水果刀 wpf做自适应拉伸窗体,会更好一些. 代码: #region 自适应 priva ...

  8. add a private constructor to hide the implicit public one(Utility classes should not have public constructors)

    sonarlint提示add a private constructor to hide the implicit public one Utility classes should not have ...

  9. Android Studio添加so文件并打包到APK的lib文件夹中

    Gradle官方在新版本中已经实现了自动打包.so文件功能了. 只需要在build.gradle的文件中的android目录下配置一下即可: sourceSets { main { jniLibs.s ...

  10. ubuntu 12.04 上网体验

    买了新的电脑,装的系统ubuntu12.04.  但是开始的时候无法使用有线网络,也没有办法连上无线网络.这相当于一个与世界剥离的裸机器,很是郁闷.于是在网上买了一个无线网卡tplink721, 但是 ...