全WA,dalao求调
查看原帖
全WA,dalao求调
1295871
TODAYS楼主2024/7/22 11:35
#include <bits/stdc++.h>
using namespace std;

string ans[55], str, s[55];
int T, n;

void solved()
{
	string id, now;
	int sum = 0;
	int ans2 = 0;
	int cnt = 1;
	cin >> id >> now;
	int len = id.size();
	for (int i = len - 1; i >= 0; i--)
	{
		ans2 += (id[i] - '0') * cnt;
		cnt *= 2;
	}
	if (ans2 < 1 || ans2 > 10000)
	{
		cout << "Wrong ID\n";
		return ;
	}
	cout << "ID: " << ans2 << "\n";
	if ((id[15] == 1 && now[1] == 1 && now[0] == 0) || (id[15] == 0 && now[0] == 0 && now[1] == 1))
	{
		cout << "Type Correct\n";
	} // 01是A卷 10是B卷 id[i] == 1表示是A卷 id[i] == 0 表示是B卷
	else
	{
		cout << "Type Incorrect\n";
	}
	int tian = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		if (s[i] == ans[i])
		{
			tian++;
		} 
	}
	double pre = 100 / n * tian;
	cout << fixed << setprecision(1);
	cout << pre << "\n";
	return ;
}

int main()
{
	cin >> T >> n;
	cin >> str;
	for (int i = 0; i < str.size(); i++)
	{
		ans[i] = "0000";
		ans[i][str[i] - 'A'] = '1';
		/*
			str[i] = 'A'
			0 + 1
		*/
	}
	while (T--)
	{
		solved();
		cout << "\n";
	}
	return 0;
}
2024/7/22 11:35
加载中...