UVA 10361-Automatic Poetry

UVA 10361 - Automatic Poetry 题目大意:输入两串字符串,将第一串去掉“”内容对换去掉“ 解题思路:将第一个与第二个内以及第二个 ac代码: #include #include using namespace std; int n, len, cnt; char a[1005], b[1005], t1[2][105], t2[2][105]; int main() { scanf("%d", &n); 阅读详情

UVA 10361-Automatic Poetry

题目大意: 给俩个字符串,第一个含有俩次<>,第二个以…结尾,输出第一条将第一个字符串的<>去掉,第二条将第二个字符串的…改为规定规律的字符串

解题思路: 边输入边输出边判断

#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    getchar();
    while(n--) {
        char t;
        char c[4][100];
        for(int i = 0; i < 4; i++)
            memset(c[i], 0, sizeof(c[i]));
        for(int i = 0; (t = getchar()) != '<'; i++)
            printf("%c", t);
        for(int i = 0; (t = getchar()) != '>'; i++) {
            printf("%c", t);
            c[0][i] = t;

        }
        for(int i = 0; (t = getchar()) != '<'; i++) {
            printf("%c", t);
            c[1][i] = t;
        }
        for(int i = 0; (t = getchar()) != '>'; i++) {
            printf("%c", t);
            c[2][i] = t;
        }
        for(int i = 0; (t = getchar()) != '\n'; i++) {
            printf("%c", t);
            c[3][i] = t;
        }
        printf("\n");
        for(int i = 0;(t = getchar()) != '.'; i++)
            printf("%c", t);
        for(;(t = getchar()) != '\n';)
            ;
        printf("%s%s%s%s\n", c[2], c[1], c[0], c[3]);


    }

return 0;
}
UVA10361 - Automatic Poetry 没想到这样一个水题也把我憋了这么久,唉,方法很简单把因‘<’'>'号分开的几部分字符串分别放在不同的数组里,输出时,第一行忽略<>号输出,第二行先输出...前面的,后面的变换一下第一行的字符串顺序输出就可以了。 困住我的地方:测试组数的输入问题,评测之后出现runtime error。 while(gets(num) != NULL) { sscanf(num,"%d"... 阅读详情

相关推荐

uva 10361(字符串)

题目: “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”In Tomb Raider XIV, Lara is, as ever, gunning her way through ancient Egyptian pyramids, prehistoric caves and medival hallwa

俯瞰风景 989

UVA10361字符串水题多坑)

Automatic Poetry Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu 题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=25129 Description Time Limit: 2 seconds

代码艺术的道与术 877

字符串系列——uva10361 - 自动作诗机

Problem I Automatic Poetry Input:standard input Output:standard output Time Limit:2 seconds Memory Limit:32 MB “Oh God”, Lara Croft exclaims, “it’sone of these dumb riddles again!” ...

weixin_30672019的博客 178

UVA - 10361 Automatic Poetry

UVA - 10361 Automatic Poetry题目大意:题目大意:给出两个序列,第一个 s1s3s5,第二个 S…。输出两个序列,第一个删除括号,即 s1s2s3s4s5,第二个将 s2 与 s4 交换位置后替换…,即 Ss4s3s2s5。解题思路:根据 < 和 > 将字符串分成 5个部分 交换 s2 s4 即可#include<iostream> #include<cstdio> #in

cwb15505905513的博客 358

UVa 10361 - Automatic Poetry

其实 这都题目并不难,就是简单处理字符串的问题,不过有一点要注意的是,在取s2,s3,s4,s5 的时候,空格也是其中的一部分。 下面是我的代码: #include #include int main() { int i,j,n,x,key,key1; int flag; char s1[1000][100]; char s2[100],s3[100],s4[100],s5[10

ACM2272902662的专栏 892

uva10361 Automatic Poetry

10361 Automatic Poetry “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb Raider XIV, Lara is, as ever, gunning her way through ancient Egyptian pyramids, prehistoricca

xlt1996的博客 436

UVa10361 Automatic Poetry

Problem I Automatic Poetry Input: standard input Output: standard output Time Limit: 2 seconds Memory Limit: 32 MB   “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”

江枭的专栏 693

UVA10361Automatic Poetry

题目描述 “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb Raider XIV, Lara is, as ever, gunning her way through ancient Egyptian pyramids, prehistoric caves and medival hallw...

qq_44859533的博客 307

UVA-10361 Automatic Poetry

原题连接: https://vjudge.net/problem/UVA-10361 AC代码: #include <bits/stdc++.h> using namespace std; void getsi(char str[]) { char c; int i = 0; while (c = getchar()) { if (c != '<' && c != '>' && c != '\n')

sjyisdog的博客 170

UVA 10361 Automatic Poetry

yiyi: 输入: 输入N组测试用例,每组输入两个字符串。 第一个字符串格式:s12>s34>s5 s1,s2,s3,s3,s4,s5都可以为空或者不存在或者全是小写字符 第二个字符串格式:s .... 输出: 每组测试用例输出两个字符串。 第一个字符串格式:s1s2s3s4s5 第二个字符串格式:ss4s3s2s5 yiyi:

哈希的博客 300

uva 10361 - Automatic Poetry

UVA 10361 - Automatic Poetry #include #include int main(){ char ch1[110], ch2[110], temp[5][110], temp2[110]; int count, str = 0, count2 = 0; scanf("%d\n", &count);//没有\n会影响下面的gets() while (coun

总有那么一群人喜欢盯着我的博客看,估计这是他们见过最长的博客名,我必须得告诉他们博客名最长可以写多长 602

uva 10361 Automatic Poetry

简单字符串题目 #include #include #define MAX_LEN 150 char I1[MAX_LEN]; char I2[MAX_LEN]; char s1[MAX_LEN]; char s2[MAX_LEN]; char s3[MAX_LEN]; char s4[MAX_LEN]; char s5[MAX_LEN]; void split() { cha

皓首不倦 不负少年 643

UVA 10361 Automatic Poetry

题目要求很简单,给两个字符串,第一个字符串中有'’的符号,整个字符串可以分为s1s3s5。第二个字符串中结尾是'...'。要求输出两个字符串,一个是将第一个字符串中的''去掉,另一个是在第二个字符串后面加上s4s3s2s5。直接模拟即可。 #include #include #include #include using namespace std; int main() { int n,l1

hahahaha 651

uva 10361 Automatic Poetry字符串处理)

Automatic Poetry Input: standard input Output: standard output Time Limit: 2 seconds Memory Limit: 32 MB   “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!”   In Tomb

不慌不忙、不急不躁 1217

POJ1917 UVA10361 Automatic Poetry【文本】

Automatic Poetry Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 2373 Accepted: 1176 Description Background “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb ...

海岛Blog 515
上一篇: UVA 401-Palindromes
下一篇: UVA 537-Artificial Intelligence?
ZeroLH00
博客等级 码龄10年 11粉丝 163原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值