比赛 20150420 评测结果 AAWWAAWAAW
题目名称 最终得分 60
用户昵称 wolf. 运行时间 0.012 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-04-20 11:37:08
显示代码纯文本
#include<iostream>
#include<fstream>
#include<bitset>
#include<vector>
#include<deque>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdio>
using namespace std;
#if defined wolf
const string ok="OK";
const string kk="	";
ofstream nnew("cowa.in",ios::app);
ifstream fin("cowa.in");
#define fout cout
#define Endl endl
#else
ifstream fin("cowa.in");
ofstream fout("cowa.out");
#endif
int main(){
	int n;
	fin>>n;
	long long c=0,re=0;
	long long ans=0;
	for(int i=0;i!=n;++i){
		char txt;
		fin>>txt;
		if(txt=='C'){
			c++;
		}else if(txt=='O'){
			re+=c;
		}else{
			int k=1;
			while(fin.peek()=='W'){
				fin>>txt;
				++k;
				++i;
			}
			ans*=(k+1);
			ans+=re*k;
			re=0;
		}
	}
	fout<<ans<<endl;
	//-------------------------*/
	#if defined wolf
	cout<<endl<<(double)clock()/CLOCKS_PER_SEC<<'s'<<endl;
	#endif
	return 0;
}
//Designed by wolf
//Mon Apr 20 2015