我是靠谱客的博主 舒心老师,这篇文章主要介绍String Task CodeForces - 118A,现在分享给大家,希望可以做个参考。

Text Reverse
Time limit 2000 ms
Memory limit 262144 kB
Source Codeforces Beta Round #89 (Div. 2)
Tags implementation strings *1100
Editorial Announcement Tutorial #1 Tutorial #2

Problem Description
Calculate A + B.

Input
The first line represents input string of Petya’s program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.

Output
Print the resulting string. It is guaranteed that this string is not empty.

Sample Input
Input
tour
Output
.t.r
Input
Codeforces

Sample Output
.c.d.f.r.c.s
Input
aBAcAba
Output
.b.c.b

问题链接:CodeForces - 118A

问题简述:

输入测试字符串,在给定的字符串中(包括大写字母和小写拉丁字母),它:删除所有元音,插入一个字符“。在每个辅音之前,用相应的小写辅音替换所有大写辅音。元音是字母“A”、“O”、“Y”、“E”、“U”、“I”,其余都是辅音。以单个字符串的形式返回输出。

问题分析:
利用ASCII码大小写的数值差实现大小写转换

程序说明:
利用ASCII码大小写的数值差实现大小写转换,然后依靠条件判断删去元音字母。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream> using namespace std; int main() { char p[101], a[201]; char *s = p; cin >> p; int j = 0; for (int i = 0; *(s + i) != ''; i++) { if (*(s+i) >= 'A'&& *(s+i) <= 'Z') *(s + i) += 32; if (*(s + i) !='a' && *(s + i) != 'e' && *(s + i) != 'i' && *(s + i) != 'o' && *(s + i) != 'u' && *(s + i) != 'y') { a[j++] = '.'; a[j++] = s[i]; } } a[j] = ''; cout << a << endl; }

最后

以上就是舒心老师最近收集整理的关于String Task CodeForces - 118A的全部内容,更多相关String内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部