#include <bits/stdc++.h>
using namespace std;
struct s {
string name;
bool ik = false; //是否秒殺
bool correct = false; //若ac過便改為true
}user[10000];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
unsigned int t;
string c, n;
int now_people = 0, instant_kill = 0, AC_people = 0;
bool newp = true;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n >> c;
for (int i = 0; i < now_people; i++) {
if (user[i].name == n) {
newp = false;
break;
}
else newp = true;
}
if (c == "AC") {
user[now_people].ik = true;
user[now_people].correct = true;
}
else {
user[now_people].ik = false;
}
if (newp == true) {
user[now_people].name = n;
now_people++;
}
newp = false;
c.clear();
n.clear();
}
for (int j = 0; j < now_people; j++) {
if (user[j].correct == true) {
if (user[j].ik == true) {
instant_kill++;
}
AC_people++;
}
}
cout << 100 * instant_kill / AC_people << "%";
}
我有看題目"此處的解題紀錄"排在前面"的資料代表時間"越晚"(與ZJ實際狀況同)",因此到最後一刻都會考慮是否秒殺(下面這段),但仍然過不了...
if (c == "AC") {
user[now_people].ik = true; //ik 是否秒殺
user[now_people].correct = true;
}
else {
user[now_people].ik = false;
}