UVALive 4873
来源:互联网 发布:java中的init方法 编辑:程序博客网 时间:2024/06/06 19:54
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#define MAX 50
using namespace std;
char str[MAX];
char s[8][4] = {"TTT","TTH","THT","THH","HTT","HTH","HHT","HHH"};
int Count[8];
void deal(char *str)
{
int len = strlen(str);
char cs[4];
for(int i = 0;i < len -2;i++)
{
cs[0] = str[i];
cs[1] = str[i+1];
cs[2] = str[i+2];
cs[3] = 0;
for(int j = 0;j < 8;j++)
if(strcmp(s[j],cs) == 0)
{
Count[j]++;
break;
}
}
}
int main()
{
freopen("in.in","r",stdin);
int test_case;
cin>>test_case;
while(test_case--)
{
int cas;
cin>>cas;
cout<<cas<<" ";
memset(Count,0,sizeof(Count));
cin>>str;
deal(str);
for(int i = 0;i < 8;i++)
cout<<Count[i]<<" ";
cout<<endl;
}
return 0;
}
- UVALive 4873
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- magento 的---分类url---重写机制的bug
- android2.3 SD卡,U盘自动挂载
- 读书笔记 节选示例
- Unix常用命令
- 如何使用VS写单元测试(转自:http://www.51crazy.net/Article/216.aspx)
- UVALive 4873
- Java 理论与实践: 构建一个更好的 HashMap ConcurrentHashMap
- UVALive 4874 进制转换
- JavaScript实现动态添加,删除行
- 队的链式实现
- UVALive 4877 记忆搜索
- linux查找命令/find/locate/whereis/which/type
- HTTP协议详解
- jmesa 使用和导出中文excel,pdf数据处理