1073.cpp

来自「杭电 acm部分代码 有兴趣的可以下载 谢谢」· C++ 代码 · 共 82 行

CPP
82
字号
#include <iostream>
#include <string>
using namespace std;
string input,output;
char key[5005];
int main()
{
	int test;
	scanf("%d", &test);
	getchar();
	while (test--)
	{
		int num = 0;
		while (true)
		{
			gets(key);
			if (strcmp(key, "START") == 0)
			{
				if (num == 0)
				{
					input.erase();
					output.erase();
				}
			}
			else if (strcmp(key, "END") == 0)
			{
				num++;
				if (num == 2)
				{
					break;
				}
			}
			else
			{
				if (num == 0)
				{
					input += key;
					input += '\n';
				}
				else if(num == 1)
				{
					output += key;
					output += '\n';
				}
			}
		}
		if (input == output)
		{
			cout << "Accepted" << endl;
		}
		else
		{
			string t1, t2;
			string::iterator point;
			t1.erase();
			t2.erase();
			for (point = input.begin(); point < input.end(); point++)
			{
				if (*point != ' ' && *point != '\t' && *point != '\n')
				{
					t1 += *point;
				}
			}
			for (point = output.begin(); point < output.end(); point++)
			{
				if (*point != ' ' && *point != '\t' && *point != '\n')
				{
					t2 += *point;
				}
			}
			if (t1 == t2)
			{
				cout << "Presentation Error" << endl;
			}
			else
			{
				cout << "Wrong Answer" << endl;
			}
		}
	}
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?