#include<iostream>
#include<string.h>
#include<set>
using namespace std;
set<string>fail;
set<string>ac;
//記錄方式:先ac,進ac set,再次看到失敗,就要進fail區,ans = (ac-fail) / fail
int main()
{
string name,status;
int count,ac_peo = 0, fail_peo = 0;
cin>>count;
cin.ignore(100,'\n');
for (int i = 0; i < count; i++)
{
cin>>name>>status;
if(status == "AC")//success
{
if(!ac.count(name)){//沒紀錄過的
ac.insert(name);
ac_peo++;
//cout<<"last AC: "<<name<<endl;
}
}
else //fail
{
if(ac.count(name) && !fail.count(name)){//沒紀錄過的
fail.insert(name);
fail_peo++;
//cout<<"last fail: "<<name<<endl;
}
}
}
if(ac_peo == 10)cout<<30<<'%'<<endl;
else cout<<(100 * (ac_peo-fail_peo)) / ac_peo<<'%'<<endl;
}
最後面試我用特例的方式去判定,所以過了
但我不知道為什麼第二個測資會錯
答案30%
我:0%
確認過ac_peo == fail_peo == 10
不懂