水题代码很好理解:
代码:
#include<iostream>
#include<string>
using namespace std;
int main()
{
int m;
string s;
cin>>m;
while(m--)
{
int p=1,n,t=0,tt;
cin>>n;
while(n--)
{
cin>>s;
if(s=="STAY")
{
cin>>tt;
t+=tt*60/p;
}
else if(s=="IN") p*=20;
else p/=20;
}
cout<<t<<endl;
}
}