POJ 3602 Typographical Ligatures
【题意简述】:题意就是输入一串字符串,问我们有多少种不同的字符,也就是说出现过一次的字符,下次就不记到种数中了,特别的有 ff, fi ,fl ,ffi ,ffl,'',``, 这几个每一个算是一种。
【分析】:经过题意简述,便好攻克了。
代码:
// 196K 0Ms
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std; char s[1000];
int count1[1000];
int ff[7];
int len; void solve()
{
int ans = 0;
memset(count1,0,sizeof(count1));
memset(ff,0,sizeof(ff));
for(int i = 0;i<len;i++)
{
if(s[i] == 'f')
{
if(s[i+1] == 'f' && (s[i+2] == 'i' || s[i+2]=='l'))
{
if(s[i+2] == 'i')
ff[0]=1;
if(s[i+2] == 'l')
ff[1]=1;
i+=2;
}
else if(s[i+1]=='f'||s[i+1]=='i'||s[i+1]=='l')
{
if(s[i+1]=='f')
ff[2]=1;
if(s[i+1]=='i')
ff[3]=1;
if(s[i+1]=='l')
ff[4]=1;
i++;
}
else
count1[s[i]]=1;
}
else if(s[i]=='`'&&s[i+1]=='`')
{
ff[5]=1;
i++;
}
else if(s[i]=='\''&&s[i+1]=='\'')
{
ff[6]=1;
i++;
}
else
count1[s[i]]=1;
}
for(int i = 0;i<=256;i++)
if(count1[i]) ans++;
for(int i = 0;i<7;i++)
if(ff[i]) ans++;
cout<<ans<<endl;
} int main()
{
char c;
len = 0;
while(cin>>c)
{
if(c == EOF) break; if(c == ' '||c == '\n') continue;
s[len++] = c;
}
solve();
return 0;
}
POJ 3602 Typographical Ligatures的更多相关文章
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- POJ 2752 Seek the Name, Seek the Fame [kmp]
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17898 Ac ...
- poj 2352 Stars 数星星 详解
题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- Eclipse—怎样为Eclipse开发工具中创建的JavaWebproject创建Servlet
在博客<在Eclipse中怎样创建JavaWebproject>中图文并茂的说明了Eclipse中创建JavaWebproject的方法,本篇博客将告诉大家怎样为Eclipse开发工具中创 ...
- emacs quick open and jump file (or buffer) which name is current word
Sometime, we need to open a file or buffer which name begin with current word in emacs. Here I give ...
- 每天一个JavaScript实例-canvas绘图
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- ASP.NET MVC流程解说
开始想这个标题时,,很忧郁什么标题将得到更好的叫什么,最后确定的解释,虽然稍0基金会,但是,这个概念是非常.我想出了一个相当的价格值的. ,開始. 1.MVC的基本开发流程 2.webform和M ...
- 纯CSS3彩色边线3D立体按钮制作教程
原文:纯CSS3彩色边线3D立体按钮制作教程 今天我们来分享一款利用纯CSS3实现的3D按钮,这款按钮的一个特点是有彩色的边线,这让整个按钮显得比较多姿多彩,没那么枯燥无趣.本文不仅可以让大家看到演示 ...
- C/C++各种类型int、long、double、char表示范围(最大和最小)
#include<iostream> #include<string> #include <limits> using namespace std; int mai ...
- 教你Ant安装和配置
Ant它是基于Java施工工具,它的主要作用是产生能够运行Java计划,把握Ant一些功能可以使项目更专业. 忙乱,可以在这里下载2014年8最近一个月Ant http://download.csdn ...
- Java日期的格式String类型GMT,GST换算成日期Date种类
请尊重他人的劳动成果.转载请注明出处:Java日期格式化之将String类型的GMT,GST日期转换成Date类型 http://blog.csdn.net/fengyuzhengfan/articl ...
- 找呀志_使用SQLiteDatabase增删改提供的搜索方法和事务
知识具体解释:http://blog.csdn.net/zhaoyazhi2129/article/details/9026093 MainActivity.java,User.java,BaseDa ...
- ASP.NET MVC上传文件----uploadify的使用
课程设计需要实现上传文件模块,本来ASP.NET是有内置的控件,但是ASP.NET MVC没有,所以就有两种方法:自定义和采用第三方插件.由于时间的关系,故采用第三方插件:uploadify. upl ...