codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)
题目链接: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)的更多相关文章
- codeforces水题100道 第二十五题 Codeforces Round #197 A. Helpful Maths (Div. 2) (strings)
题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include ...
- 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 ...
- codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)
题目链接:http://www.codeforces.com/problemset/problem/118/A题意:字符串转换……C++代码: #include <string> #inc ...
- codeforces水题100道 第十六题 Codeforces Round #164 (Div. 2) A. Games (brute force)
题目链接:http://www.codeforces.com/problemset/problem/268/A题意:足球比赛中如果主场球队的主场球衣和客队的客队球衣颜色一样,那么要求主队穿上他们的可对 ...
- 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]区间的 ...
- 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]( ...
- 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 ...
- 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双袜子, ...
- 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 ...
随机推荐
- L0、L1及L2范数
L1归一化和L2归一化范数的详解和区别 https://blog.csdn.net/u014381600/article/details/54341317 深度学习——L0.L1及L2范数 https ...
- Axiom3D写游戏:用Overlay实现Mesh浏览.
从网上找了些资源,大多搜Ogre,Mesh资源,然后为了方便查看各个Mesh,以及对应骨骼动画.为了实用性,考虑放在原游戏窗口里实现.最开始打算窗口新建viewport来实现,后发现这种方式的局限性, ...
- OpenGL 用三角形模拟生成球面
在看OpenGL红皮书,看到生成球体这节,讲了很多,总感觉不如自己动手写一些代码来的实在,用OpenGL中三角形模拟球形生成.主要要点,模型视图变换,多边形表面环绕一致性,矩阵堆栈.先贴上代码. 虽然 ...
- 【转】【WPF】WPF中MeasureOverride ArrangeOverride 的理解
1. Measure Arrange这两个方法是UIElement的方法 MeasureOverride ArrangeOverride这两个方法是FrameworkElement的方法,Framew ...
- Kb,KB,Kbps,Mb,Mbps等一些列概念
先普及一下Kb,KB,Kbps,Mb,Mbps等一些列概念 1Byte = 8bit1KB (Kilobyte 千字节)=1024Byte1MB (Megabyte,兆字节,简称“兆”)=1024KB ...
- SQL数据查询之——嵌套查询
一.概念描述 在SQL语言中,一个 SELECT-FROM-WHERE 语句称为一个查询块.将一个查询块嵌套在另一个查询块的 WHERE 子句或 HAVING 短语的条件中的查询称为 嵌套查询.例如: ...
- JDBC事务保存点(setSavepoint, releaseSavepoint )实例
以下是使用事务教程中描述的setSavepoint和回滚的代码示例. 此示例代码是基于前面章节中完成的环境和数据库设置编写的. 复制并将以下示例代码保存到:JDBCSavepoint.java 中,编 ...
- Python资料收藏(杂乱版)
http://blog.csdn.net/vagrxie/article/category/343814 http://blog.sina.com.cn/s/articlelist_280149524 ...
- 因修改/etc/sudoers权限导致sudo和su不能使用的解决方法
因为修改了/etc/sudoers以及相关权限,导致sudo无法使用,恰好Ubuntu的root密码没有设置,每次执行 su - 时.输入密码,提示:认证错误 . 解决方法: 1.重启ubuntu,启 ...
- 每天一个linux命令:Linux 目录结构
对于每一个Linux学习者来说,了解Linux文件系统的目录结构,是学好Linux的至关重要的一步.,深入了解linux文件目录结构的标准和每个目录的详细功能,对于我们用好linux系统至关只要,下面 ...