#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int total_AC,spike,n,i,tail,j;
string cell[10000],p[10000],status[10000];
bool haved,AC[10000];
while (cin >> n)
{
tail = 0;
total_AC = 0;
spike = 0;
for (i=0;i<n;i++)
{
cin >> p[i]>> status[i];
}
for (i=0;i<n;i++) AC[i] = 0;
for (i=(n-1);i>=0;i--)
{
haved = 0;
for (j=0;j<tail;j++)
{
if (p[i]==cell[j])
{
haved = 1;
if (status[i][0]=='A' && AC[j]==0)
{
total_AC++;
}
break;
}
}
if (haved==0)
{
cell[tail] = p[i];
if (status[i][0]=='A')
{
spike++;
total_AC++;
AC[tail] = 1;
}
tail++;
}
}
cout << (((float)spike/total_AC)*100) << "%" <<endl;
}
return 0;
}
在#1 line:1 WA
正解是30%,我的是0.0132...略