HDU ACM 1073 Online Judge ->字符串水题

分析:水题。

#include<iostream>
using namespace std;

#define N 5050
char a[N],b[N],tmp[N];

void Read(char p[])
{
	getchar();
	gets(tmp);
	while(gets(tmp))
	{
		if(strcmp(tmp,"END")==0) break;
		if(strlen(tmp)!=0) strcat(p,tmp);
		strcat(p,"\n");
	}
}

void Process(char p[])
{
	int i,k,len;

	k=0;
	len=strlen(p);
	for(i=0;i<len;i++)
		if(p[i]!=' '&&p[i]!='\t'&&p[i]!='\n')
			p[k++]=p[i];
	p[k]='\0';
}

int main()
{
	int T;

	cin>>T;
	while(T--)
	{
		a[0]='\0';
		b[0]='\0';
		Read(a);
		Read(b);
		if(strcmp(a,b)==0)
		{
			puts("Accepted");
			continue;
		}
		else
		{
			Process(a);
			Process(b);
			if(strcmp(a,b)==0)
			{
				puts("Presentation Error");
				continue;
			}
		}
		puts("Wrong Answer");
	}
    return 0;
}
时间: 2024-10-11 23:06:22

HDU ACM 1073 Online Judge ->字符串水题的相关文章

HDU ACM 1017 A Mathematical Curiosity 水题

分析:水题,但要注意格式. #include<iostream> using namespace std; int core(int n,int m) { int i,j,ans=0; for(i=1;i<n;i++) for(j=i+1;j<n;j++) if((i*i+j*j+m)%(i*j)==0) ans++; return ans; } int main() { int T,t,n,m; bool fg=false; scanf("%d",&T

HDU ACM 5224 Tom and paper 水题+暴力枚举

分析:因为长和宽都是整数,所以枚举判断是不是整数,再取最小的即可. #include<iostream> #include<cmath> using namespace std; int main() { int min; int a,i,T; ios::sync_with_stdio(false); cin>>T; while(T--) { cin>>a; min=1000000000; for(i=1;i<=sqrt(a);i++) if(a%i=

hdu 5007(字符串水题)

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5007 Post Robot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 327    Accepted Submission(s): 253 Problem Description DT is a big fan of digital

HDU4891_The Great Pan_字符串水题

2014多校第五题,当时题面上的10^5写成105,我们大家都wa了几发,改正后我和一血就差几秒…不能忍 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4891 The Great Pan Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 966    Accepted Submission(s

HDU 1862 EXCEL排序 (排序水题)

Problem Description Excel可以对一组纪录按任意指定列排序.现请你编写程序实现类似功能. Input 测试输入包含若干测试用例.每个测试用例的第1行包含两个整数 N (<=100000) 和 C,其中 N 是纪录的条数,C 是指定排序的列号.以下有 N 行,每行包含一条学生纪录.每条学生纪录由学号(6位数字,同组测试中没有重复的学号).姓名(不超过8位且不包含空格的字符串).成绩(闭区间[0, 100]内的整数)组成,每个项目间用1个空格隔开.当读到 N=0 时,全部输入结

HDU 4007 Dave (基本算法-水题)

Dave Problem Description Recently, Dave is boring, so he often walks around. He finds that some places are too crowded, for example, the ground. He couldn't help to think of the disasters happening recently. Crowded place is not safe. He knows there

HDU 4022 Bombing(基本算法-水题)

Bombing Problem Description It's a cruel war which killed millions of people and ruined series of cities. In order to stop it, let's bomb the opponent's base. It seems not to be a hard work in circumstances of street battles, however, you'll be encou

hdu 4274 Spy&#39;s Work(水题)

Spy's Work Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1266    Accepted Submission(s): 388 Problem Description I'm a manager of a large trading company, called ACM, and responsible for the

1001 字符串“水”题

1001: 字符串“水”题 时间限制: 1 Sec  内存限制: 128 MB提交: 210  解决: 39[提交][状态][讨论版] 题目描述 给出一个长度为 n 的字符串(1<=n<=100000),求有多少个连续字串中所有的字母都出现了偶数次. 输入 第一行一个正整数 T,表示数据组数(1 <= T <= 10). 接下来 T 行,每行有一个只包含小写字母的字符串. 输出 每个答案输出满足要求字符串个数.每个答案占一行. 样例输入 3 a aabbcc abcabc 样例输出