UVA 10361 Automatic Poetry
来源:互联网 发布:手机看车用什么软件 编辑:程序博客网 时间:2024/05/18 15:08
简单的字符串处理问题, 代码如下:
#include <cstdio>#include <cstdlib>#include <cstring>#include <cctype>#define MAXN 100int n;char l1[MAXN];char l2[MAXN];char c1[MAXN];char c2[MAXN];char ss[MAXN][MAXN];int main(){ int i,j, ps; char ch; //freopen("input.txt", "r", stdin); scanf("%d", &n); getchar(); while(n--) { memset(l1, 0, sizeof(l1)); memset(l2, 0, sizeof(l2)); memset(ss, 0, sizeof(ss)); i = j = ps = 0; while((ch = getchar()) != '\n') { if(ch == '<') { ps++; j = 0; } else if(ch == '>') { ss[ps][j] = '\0'; ps++; j = 0; } else if(ch != '<' && ch != '>') { l1[i++] = ch; ss[ps][j++] = ch; } } i = 0; while((ch = getchar()) != '\n') { if(ch != '.') l2[i++] = ch; } strcat(l2, ss[3]); strcat(l2, ss[2]); strcat(l2, ss[1]); strcat(l2, ss[4]); printf("%s\n", l1); printf("%s\n", l2); } 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
- matlab BP神经网络学习
- javascripts操作DOM(Document Object Model)
- 2017 山东理工第九届校赛 C 康纳的表情包
- ANSI/ISO C的保护规则
- 网站图标
- UVA 10361 Automatic Poetry
- CSS绘制三角形
- redis实现web页面缓存
- 算法分析与设计课程12——486. Predict the Winner
- 用tarjan缩点重建图
- sql语句的简单用法
- 算法课第十五周作业 | Median of Two Sorted Arrays
- 系统学习前端之CSS 基础
- rhel7中,targetcli使用两位数的分区后缀名字(比如sda10)而导致的问题