题意什么的很普通的 就是比较2个字符串 balabala的

主要是加深下字符串的处理 这题很容易细节不处理好WA的----我一开始 TLE 惊呆了

    touch  me

 1 #include <iostream>
 2 #include <cstring>
 3 using namespace std;
 4
 5 const int size = 5010;
 6 char str1[size];
 7 char str2[size];
 8 char str3[size];
 9 char str4[size];
10 char str5[size];
11 char ch[10];
12
13 int main()
14 {
15     int n , k , t , flag;
16     char sh;
17     while( ~scanf("%d",&n) )
18     {
19         getchar();
20         while( n-- )
21         {
22             strcpy(str1,"\0");
23             strcpy(str2,"\0");
24             flag = k = t = 0;
25             gets(ch);
26             //getchar();
27             while( gets(str5) && strcmp(str5,"END")!=0 )
28             {
29                 if(flag)
30                     strcat(str1,"\n");
31                 strcat(str1,str5);
32                 flag++;
33             }
34             flag = 0;
35             //getchar();
36             gets(ch);
37             while( gets(str5) && strcmp(str5,"END")!=0 )
38             {
39                 if(flag)
40                     strcat(str2,"\n");
41                 strcat(str2,str5);
42                 flag++;
43             }
44             for( int i = 0 ; str1[i]!='\0' ; i++ )
45             {
46                 if( str1[i]!=' ' && str1[i]!='\t' && str1[i]!='\n' )
47                     str3[t++] = str1[i];
48             }
49             str3[t] = '\0';
50             for( int j = 0 ; str2[j]!='\0' ; j++ )
51             {
52                 if( str2[j]!=' ' && str2[j]!='\t' && str2[j]!='\n' )
53                     str4[k++] = str2[j];
54             }
55             str4[k] = '\0';
56             if( !strcmp(str1,str2) )
57                 printf( "Accepted\n" );
58             else if( strcmp(str3,str4)!=0 )
59                 printf("Wrong Answer\n");
60             else
61                 printf("Presentation Error\n");
62         }
63     }
64     return 0;
65 }

View Code

洗澡去了~~

转载于:https://www.cnblogs.com/radical/p/3869160.html

hdu--1073--字符串处理相关推荐

  1. HDU 2017 字符串统计

    http://acm.hdu.edu.cn/showproblem.php?pid=2017 Problem Description 对于给定的一个字符串,统计其中数字字符出现的次数. Input 输 ...

  2. hdu 4850 字符串构造---欧拉回路构造序列 递归+非递归实现

    http://acm.hdu.edu.cn/showproblem.php? pid=4850 题意:构造长度为n的字符序列.使得>=4的子串仅仅出现一次 事实上最长仅仅能构造出来26^4+4- ...

  3. hdu 1106 字符串处理

    这题主要用到字符串的分割,和字符型转换成整型,这其实可以用两个函数来代替. atoi这个函数原来做进制转换的时候就接触过.如果第一个非空格字符不存在或者不是数字也不是正负号则返回零,否则开始做类型转换 ...

  4. HDU 6208 (字符串hash)

    题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=6208 题意:给你n个串,能不能在这n个串中找到一个串,使得其它所有的串都是这个串的子串. ...

  5. hdu 3788 字符串

    题目很简单,可是打了一个小时,这种题目真是悲剧啊 /* * hdu3788/win.cpp * Created on: 2011-9-6 * Author : ben*/#include <cs ...

  6. hdu 1800 字符串水题 可用字符串hash 字典树做 我用了最水的排序水过

    具体详解 http://www.cnblogs.com/liqiangqiang/articles/2722116.html 转载于:https://www.cnblogs.com/liqiangqi ...

  7. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  8. HDU题目分类啊!!!

    分类一(详细): 分类二: 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.10 ...

  9. hdu 杭电题目分类

    View Code 1 1001 这个就不用说了吧 2 1002 简单的大数 3 1003 DP经典问题,最大连续子段和 4 1004 简单题 5 1005 找规律(循环点) 6 1006 感觉有点B ...

  10. 转载:Hdu 题目分类

    原址点击 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056. ...

最新文章

  1. 设计模式系列3-----C++实现命令模式(Command Pattern)
  2. ISR:中断服务程序需要满足的要求
  3. 完美解决Ubuntu16.04虚拟机窗口自适应问题
  4. php array 如何访问,php – 如何访问$array [@key]值
  5. Oracle %rowtype的用法
  6. OleDbCommandBuilder 使用方法
  7. 现实给了梦想多少时间?
  8. opencv_haartraining.exe 分类器训练----命令执行,执行项学习(1)
  9. extern 关键字详解
  10. 第五章 PYTHON标准库
  11. PC微信多开源代码-消息钩子+ZwQuerySystemInformation
  12. 用74ls90组成二十四进制计数器_89c52定时计数器T2
  13. 单点登录系统和传统登录的区别
  14. 【数学】线性增长,指数增长,对数增长,幂增长
  15. 查看本机网卡MTU值
  16. 为什么要用深浅拷贝、什么是深浅拷贝、以及如何实现
  17. ORA-01017: invalid username/password; logon denied ORA-02063: 紧接着line(源于DBLINKN~~~)
  18. sql server和mysql都装_mysql和sql server可以同时安装吗
  19. leetcode 18. 四数之和 (C++)
  20. ECE220生存指南[02] MP7: GDB 调试Debug

热门文章

  1. unity打开excel表格_Excel电子表格需要双击两次才能打开问题的解决方案
  2. div旋转45度_一看就会,一做不废的旋转楼梯建模
  3. python安装选项_Python PyInstaller安装和使用教程(详解版)
  4. (day 34 - 哈希表 or 双指针 )剑指 Offer 57. 和为s的两个数字
  5. db2设置默认schema_dataSource配置jdbc连接db2源url项指定currentSchema
  6. java final对象_JAVA final 与 不可变对象
  7. CSS:实现跳动小球蒙版效果
  8. python获取当前时间的源代码_python怎么获取当前系统时间
  9. 7z增量更新参数使用
  10. Web前端实现锁屏/解锁功能