| 记录编号 | 38911 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 823.[RQNOJ 165] FBI序列 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.004 s | ||
| 提交时间 | 2012-06-21 15:14:22 | 内存使用 | 0.31 MiB | ||
#include<fstream>
#include<cstring>
using namespace std;
int main(void)
{
	ifstream fin("fbi.in");
	ofstream fout("fbi.out");
	int n,m=0;
	string st;
	fin>>st;
	n=st.length();
	int f=0,b=0,i=0;
	for(int j=0;j<n;j++)
	{
		if(st[j]=='F')
			f++;
		if(st[j]=='B')
			b+=f;
		if(st[j]=='I')
			m+=b;
	}
	fout<<m;
	fin.close();
	fout.close();
	return 0;
}