Text Reverse hdu1062 水题
来源:互联网 发布:炉石代练软件 编辑:程序博客网 时间:2024/05/29 19:36
http://acm.hdu.edu.cn/showproblem.php?pid=1062
需要注意的就是,单词与单词之间的空格都是要输出的。。有几个空格就输出几个空格。还有这个题的空白只有空格,没有/t等其它的符号。
莫名的就感觉这个题目好坑人。 一开始提交的几次都表达错了,想了很久也没想明白。。 =w=
#include <iostream>#include <string.h>using namespace std;#define N 1005char s[N],t[N];void print(char *str){ //反向输出。int i;for (i=strlen(str)-1;i>=0;i--)printf("%c",str[i]);}int main(){#ifndef ONLINE_JUDGEfreopen("1062in.txt","r",stdin);#endifint c,len,i,j;scanf("%d",&c);getchar();while (c--){gets(s);len=strlen(s);s[len]=' ';s[len+1]='\0';t[0]='\0';for (i=0,j=0;i<=len;i++){if (s[i]==' '){ //如果遇到空格就输出t,t用来记录非空格的字符。print(t);t[0]='\0';printf("%c",i==len?'\n':' ');j=0;continue;}else {t[j]=s[i];j++;t[j]='\0'; //用斜杠0记录终点,这个很重要哦。=w=}}}return 0;}
- Text Reverse hdu1062 水题
- hdu1062(Text Reverse)
- HDU1062:Text Reverse
- hdu1062 Text Reverse
- HDU1062 Text Reverse
- hdu1062:Text Reverse
- HDU1062 Text Reverse
- Hdu1062 Text Reverse
- hdu1062 - Text Reverse
- hdu1062-Text Reverse
- HDU1062 Text Reverse
- HDU1062 Text Reverse
- HDU1062 Text Reverse
- hdu1062——Text Reverse
- hdu1062 Text Reverse (c++输入输出流)
- hdu1062 Text Reverse(C语言)
- 面试100题系列之8单词反转 VS HDU1062——text reverse
- hdu1062-字符串翻转问题 reverse()
- IE开发人员工具不显示的解决方法
- 抽象编程
- 工厂方法模式
- Nginx安装报错:./configure: error: the HTTP rewrite module requires the PCRE library.
- common-io 之ByteArrayOutputStream阅读
- Text Reverse hdu1062 水题
- 第一天学习Illustrator CS3 (AI) 总结
- android 编译应用程序Settings
- 延迟提交技术
- commons-io之ThresholdingOutputStream 和 DeferredFileOutputStream
- Get Oracle Home & Oracle SID from PLSQL
- Asp.net常用加密和解密方法
- Java编程中“为了性能”需做的26件事
- mysql auto_increment_increment和auto_increment_offset