标签:
#include <cstdio>
using namespace std;
typedef long long LL;
const int maxn = 50;
int a[maxn];
int main(){
int n,p;
char op[20];
scanf("%d%d",&n,&p);
for(int i = 0; i < n;++i){
scanf("%s",op);
a[i] = op[4] != ‘\0‘;
}
LL cnt = 0,bcnt = 0;
for(int i = n - 1;i >= 0 ;--i){
if(a[i]){
cnt = cnt * 2 + 1;
++bcnt;
}else{
cnt = cnt * 2;
}
}
printf("%I64d\n",cnt*p - bcnt * (p / 2));
return 0;
}
[2016-03-26][codeforces][632][A][Grandma Laura and Apples]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/17be49109610a1d24ddad5c171a5287a.html