P5587求助
  • 板块题目总版
  • 楼主WD2c0mP
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/7/10 19:18
  • 上次更新2024/7/10 20:44:30
查看原帖
P5587求助
780641
WD2c0mP楼主2024/7/10 19:18
#include<bits/stdc++.h>
using namespace std;
string a[100010], b[100010], c[100010];
int cnt, cnt1;
string ers(string s, int l, int r) {
	int n = s.size();
	return s.substr(0, l) + s.substr(r + 1, n - r);
}
int main() {
	string s1, s2;
	while (getline(cin, s1) && s1 != "EOF") {
		a[++cnt1] = s1;
	}
	while (getline(cin, s2) && s2 != "EOF") {
		b[++cnt] = s2;
	}
	for (int i = 1; i <= cnt; i ++) {
		string s = "";
		for (unsigned j = 0; j < b[i].size(); j ++) {
			if (b[i][j] != '<') s += b[i][j];
			else s = s.substr(0, s.size() - 1); // 删掉一位
		}
		b[i] = s;
	}
	int ans = 0;
	for (int i = 1; i <= cnt; i ++) {
		for (unsigned j = 0; j < b[i].size(); j ++) {
			//cout << a[i][j] << " " << b[i][j] << endl;
			if (a[i][j] == b[i][j]) ans ++;
		}
	}
	int tm;
	cin >> tm;
	ans = ans * 60;
	cout << round(ans * 1.0 / tm) << endl;
	return 0;
}

40pts WA???

2024/7/10 19:18
加载中...