#include<iostream>
#include<stack>
#include<string>
#define R(x) x=read()
using namespace std;
inline int read(){
int x=0,y=1;char e=getchar();
while(e>'9'||e<'0'){
if(e=='-')y=-1;
e=getchar();
}
while(e>='0'&&e<='9'){
x=(x<<3)+(x<<1)+(e^'0');
e=getchar();
}
return x*y;
}
int n,T,cnt;
stack <char> st;
string s;
double tot;
signed main(){
int pow2[]={1,2,4,8,16};
R(n),R(T);
while(cin>>s){
for(int i=0;i<s.size();++i){
if(s[i]==' ')continue;
if(s[i]=='('){
st.push('(');
continue;
}
if(s[i]==')'){
st.pop();
continue;
}
if(s[i+1]=='-'){
int ct=1,j;
for(j=i+1;j<s.size();++j){
if(s[j]=='-'){
++ct;
}else{
break;
}
}
if(s[j]=='.'){
tot+=(1.5*ct);
i=j;
}
else{
tot+=ct;
i=j-1;
}
continue;
}
if(st.size()){
if(s[i+1]=='.'){
tot+=(1.5/pow2[st.size()]);
i++;
}
else{
tot+=(1.0/pow2[st.size()]);
}
continue;
}else{
if(s[i+1]=='.'){
tot+=1.5;
i++;
}else{
tot++;
}
}
}
}
printf("%d\n",(int)(tot*60/T));
return 0;
}
有个问题,我把while(cin>>s)改成getline(cin,s)洛谷就过不了,但本地能过。如果是在考场上,我该怎么办?