HNOJ LOL
来源:互联网 发布:深入java虚拟机 pdf 编辑:程序博客网 时间:2024/06/12 00:59
4fotballsoppingentingspilloljeSample Output
1230Judge Tips0 < T <= 100 0 < |S| <= 50 (That is, the maximal string length is 50.)Problem Source
IDIOPEN 2011
题目思路:只要查找字符子串,再处理就OK的了
program:
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
char ch[55];
int main()
{
int test;
cin>>test;
while(test--)
{
cin>>ch;
if(strlen(ch)==1)
{
if(ch[0]=='l'||ch[0]=='o')
{
cout<<2<<endl;
continue;
}
else
{
cout<<3<<endl;
continue;
}
}
char *p;
char a[5]={"lol"},b[5]={"lo"},c[5]={"ol"},d='l',e='o',f[5]={"ll"};
p=strstr(ch,a);
if(p)
{
cout<<0<<endl;
//cout<<"---------1"<<endl;
continue;
}
p=strstr(ch,b);//////
if(p)
{
cout<<1<<endl;
//cout<<"---------2"<<endl;
continue;
}
p=strstr(ch,c);//////
if(p)
{
cout<<1<<endl;
//cout<<"---------3"<<endl;
continue;
}
p=strstr(ch,f);//////
if(p)
{
cout<<1<<endl;
//cout<<"---------4"<<endl;
continue;
}
for(int i=0;i<(strlen(ch)-2);i++)
{
if(ch[i]=='l'&&ch[i+2]=='l')
{
cout<<1<<endl;
// cout<<"---------5"<<endl;
goto end;
}
}
p=strchr(ch,d);/////
if(p)
{
cout<<2<<endl;
//cout<<"---------6"<<endl;
continue;
}
p=strchr(ch,e);/////
if(p)
{
cout<<2<<endl;
//cout<<"---------7"<<endl;
continue;
}
cout<<3<<endl;
end:;
}
//system("pause");
return 0;
}
- HNOJ LOL
- HNOJ Beads
- hnoj beads
- LOL
- LOL
- [ lol
- LOL
- HNOJ - 121580 纯思维题...
- HNOJ Is it a Number?
- LOL秘籍
- lol 发新帖
- 咯lol
- lol匹配算法
- LOL如何拯救小学生
- LOL视角挂一枚
- LOL 战斗力查询
- lol英雄列表显示
- LOL的庆祝
- sql面试题1
- socketpair的使用
- 对Python特色的详细介绍
- zoj 3203 Light Bulb(三分)
- 网络经济与企业管理 第一章
- HNOJ LOL
- IIS 下301重定向之服务器设置和代码设置
- NAND FLASH 内存详解与读写寻址方式
- 不让感情占据那短暂的青春
- C++中类似C# region的功能
- 雷佳歌声动我
- 自动生成Makefile
- startx启动分析
- Oil Deposits(DFS,基础题)