1040
作者:
峡迩 | 来源:发表于
2017-09-03 11:20 被阅读0次// 部分结果超时,怎么处理?
//
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
unsigned count_pat(string &tmp)
{
unsigned count = 0;
for (size_t i = 0; i < tmp.size(); ++i)
{
if (tmp[i] == 'P')
{
for(size_t j=i+1;j<tmp.size();++j)
if (tmp[j] == 'A')
{
for (size_t k = j + 1; k < tmp.size(); ++k)
{
if (tmp[k] == 'T')
{
++count;
count = count % 1000000007;
}
}
}
}
}
return count;
}
int main()
{
string str;
cin >> str;
cout << count_pat(str);
system("pause");
return 0;
}
本文标题:1040
本文链接:https://www.haomeiwen.com/subject/lpgdjxtx.html
网友评论