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个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- ssis package 在调试状态中设置断点,程序 不进入断点 的解决方案
原文:ssis package 在调试状态中设置断点,程序 不进入断点 的解决方案 针对 SSIS intergation 项目 > 属性 > Debug >Run64bITRunt ...
- JAVA —— 数组
import java.util.Arrays; public class Array { public static void main(String[] args){ Array test= ...
- 树莓派的演奏音符3 -- LCD1602显示文章
LCD1602它是低-cost输出装置.它具有体积小.简单的操作.低功耗优势.因此,在一些DIY 用它来输出关于产品的一些信息. 昨日在使用,尽管平局网上资源,但仍存在一些问题,确处理. 一.LCD1 ...
- 用CSS3制作很特别的波浪形菜单
原文:用CSS3制作很特别的波浪形菜单 网页菜单我们见过很多,各种炫酷的.实用的菜单比比皆是.昨天我看到一款很特别的CSS3菜单,它的外形是波浪形的,弯弯曲曲,结合背景,看上去还挺不错的,下面看下一效 ...
- CentOS安装KVM步骤虚拟机,绝对实用!
KVM(Kernel-based Virtual Machine)速记.这是rhel5.4最新的虚拟化技术启动,现在只支持红帽64位rhel5.4在执行KVM,硬件必须支持同一时间VT技术,网上找 ...
- Model-View-Presenter(MVP)
Model-View-Presenter(MVP)模式 Model-View-Presenter(MVP)是一种应用程序表示层的设计模式.该设计模式最早于90年代由Taligent提出,并率先在C++ ...
- ElasticSearch实战
ElasticSearch实战-入门 1.概述 今天接着<ElasticSearch实战-日志监控平台>一文来给大家分享后续的学习,在<ElasticSearch实战-日志监控平台& ...
- HR系统邮件审批功能总结
时至今日,来兰亭工作的第三个小任务算是暂时告一段落了.这个小任务是耗费时间最长的,因此在这里总结整理一下. 首先这个功能的出发点是方法领导进行手下员工的审批,包括加班申请,休假申请,和漏打卡申请.由于 ...
- hdu 5060 War
War Time Limit: 8000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- Leetcode dfs Combination SumII
Combination Sum II Total Accepted: 13710 Total Submissions: 55908My Submissions Given a collection o ...