| 比赛 | 
    20120619 | 
    评测结果 | 
    AAAAAAAAAA | 
    | 题目名称 | 
    FBI序列 | 
    最终得分 | 
    100 | 
    | 用户昵称 | 
    TBK | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2012-06-19 21:16:22 | 
显示代码纯文本
#include <iostream> 
#include <cmath> 
#include <cstring> 
#include <string> 
#include <cstdio> 
#include <cstdlib> 
#include <iomanip> 
#include <set> 
#include <algorithm> 
#define MAXN 0x7fffffff 
using namespace std; 
string str;
int a[3],b,c,d;
int main(void) 
{    
    freopen("fbi.in","r",stdin); 
    freopen("fbi.out","w",stdout); 
	cin>>str;
	for (b=0;b<str.length();b++)
	{
		if (str[b]=='F') a[0]++;
		if (str[b]=='B') a[1]+=a[0];
		if (str[b]=='I') a[2]+=a[1];
	}
	cout<<a[2];
    fclose(stdin);
    fclose(stdout); 
    return 0; 
}