90 wa on #1,救救孩子吧
查看原帖
90 wa on #1,救救孩子吧
1084121
lx2023211291楼主2023/11/28 09:28
#define  _CRT_SECURE_NO_WARNINGS
#include <cstring>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <ctype.h>
#include <ctime>
#include <stack>
#include <list>
#include <queue>
#include <algorithm>
using namespace std;

int main()
{
	string x[10010],y[10010];
	int lengthx = 0;
	for (;; lengthx++)
	{
		getline(cin,x[lengthx]);
		if (x[lengthx] == "EOF")
		{
			break;
		}
	}
	int lengthy = 0,num = -8;
	for (; lengthy <= lengthx; lengthy++)
	{
		getline(cin, y[lengthy]);	
		if (y[lengthy] == "EOF")
		{
			cin >> num;
			break;
		}
	}
	for (;num == -8;)
	{
		string j;
		getline(cin,j);
		if (j == "EOF")
		{
			cin >> num;
			break;
		}
	}
	int ans = 0;
	for (int i = 0; i < lengthx&&i<lengthy; i++)
	{
		char s[100010] = { NULL };
		char t[100010] = { NULL };
		for (int j = 0, k = 0; j < y[i].size(); j++)
		{
			if (y[i][j] != '<')
			{
				s[k] = y[i][j];
				k++;
			}
			else
			{
				if (k != 0)s[k--] = NULL;
			}
		}
		for (int j = 0, k = 0; j < x[i].size(); j++)
		{
			if (x[i][j] != '<')
			{
				t[k] = x[i][j];
				k++;
			}
			else
			{
				if (k != 0)t[k--] = NULL;
			}
		}
		for (int j = 0; j < strlen(t) && j < strlen(s); j++)
		{
			if (s[j] == t[j]) ans++;
		}
		
	}
	cout << (ans * 1.0 / num * 1.0) * 60<<endl;
	return 0;
}
2023/11/28 09:28
加载中...