UVA - 10361 Automatic Poetry
来源:互联网 发布:淘宝直通车养词要多久? 编辑:程序博客网 时间:2024/06/06 04:31
题目大意:给出两个序列,第一个 s1s3s5,第二个 S…。输出两个序列,第一个删除括号,即 s1s2s3s4s5,第二个将 s2 与 s4 交换位置后替换…,即 Ss4s3s2s5。
解题思路:读入两个序列,以括号为分界分别赋值给 5 个字符串,按需求输出。
#include<iostream>#include<cstdio>#include<string.h>using namespace std;char a[100005], b[100005];char s1[10005], s2[10005], s3[10005], s4[10005], s5[10005];int main() { int T; scanf("%d", &T); getchar(); while (T--) { gets(a); gets(b); int len1 = strlen(a); int len2 = strlen(b); for (int i = 0,j = 0; i < len1; i++){ for (j = 0; a[i] != '<'; i++, j++) s1[j] = a[i]; s1[j] = '\0'; i++; for (j = 0; a[i] != '>'; i++, j++) s2[j] = a[i]; s2[j] = '\0'; i++; for (j = 0; a[i] != '<'; i++, j++) s3[j] = a[i]; s3[j] = '\0'; i++; for (j = 0; a[i] != '>'; i++, j++) s4[j] = a[i]; s4[j] = '\0'; i++; for (j = 0; a[i] != '\0'; i++, j++) s5[j] = a[i]; s5[j] = '\0'; i++; } printf("%s%s%s%s%s\n", s1, s2, s3, s4, s5); int i = 0; while (b[i] != '.') printf("%c", b[i++]); printf("%s%s%s%s\n", s4, s3, s2, s5); } return 0;}
0 0
- uva 10361 Automatic Poetry
- UVa 10361 - Automatic Poetry
- uva 10361 Automatic Poetry
- UVa 10361 - Automatic Poetry
- UVa 10361 - Automatic Poetry
- uva-10361-Automatic Poetry
- UVA 10361Automatic Poetry
- UVA 10361 - Automatic Poetry
- UVa 10361 - Automatic Poetry
- UVA 10361 Automatic Poetry
- UVa 10361: Automatic Poetry
- UVA 10361 Automatic Poetry
- uva 10361 - Automatic Poetry
- UVa - 10361 - Automatic Poetry
- UVA 10361 Automatic Poetry
- UVa 10361 Automatic Poetry
- uva 10361 Automatic Poetry
- uva 10361 - Automatic Poetry
- UVA - 1368 DNA Consensus String
- UVA - 1586 Molar Mass
- tcp/ip,http,socket mysql底层技术原理
- Django Compress setup
- android 反编译
- UVA - 10361 Automatic Poetry
- Source Insight 常用设置和快捷键大全
- 升级款E4418CORE-V1C 最强最小工业级核心模块 横空出世
- ASP.NET-----验证控件
- 代理模式
- JAVA中线程池的整理
- UVA - 401 Palindromes
- iOS - 报错 Warning: Attempt to present <xx: xx> on <xx: xx> whose view is not in the window hierarchy!
- 开源MySQL数据仓库解决方案:Infobright