POJ 1496 Word Index
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 4303 | Accepted: 2439 |
Description
Consider the English alphabet {a,b,c,...,z}. Using this alphabet, a set of valid words are to be formed that are in a strict lexicographic order. In this set of valid words, the successive letters of a word are in a strictly ascending order; that is, later letters in a valid word are always after previous letters with respect to their positions in the alphabet list {a,b,c,...,z}. For example,
abc aep gwz
are all valid three-letter words, whereas
aab are cat
are not.
For each valid word associate an integer which gives the position of the word in the alphabetized list of words. That is:
a -> 1
b -> 2
.
.
z -> 26
ab -> 27
ac -> 28
.
.
az -> 51
bc -> 52
.
.
vwxyz -> 83681
Your program is to read a series of input lines. Each input line will have a single word on it, that will be from one to five letters long. For each word read, if the word is invalid give the number 0. If the word read is valid, give the word's position index in the above alphabetical list.
Input
The input will be terminated by end-of-file.
Output
Sample Input
z
a
cat
vwxyz
Sample Output
26
1
0
83681
Source
East Central North America 1995
#include <iostream>
#include <cstdio> #include <cstring> using namespace std; int c[30][30]; void Init() int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
POJ 1496 Word Index的更多相关文章
- POJ 1496 POJ 1850 组合计数
Code Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8256 Accepted: 3906 Description Tran ...
- 组合数学poj 1496 1850 同样的代码过两题
Description 1942 Transmitting and memorizing information is a task that requires different coding ...
- poj 1850/poj 1496
http://poj.org/problem?id=1850 -----------------http://poj.org/problem?id=1496 两题解法类似..本题为组合数学的题,要求所 ...
- 【 POJ - 1204 Word Puzzles】(Trie+爆搜|AC自动机)
Word Puzzles Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 10782 Accepted: 4076 Special ...
- poj 1204 Word Puzzles(字典树)
题目链接:http://poj.org/problem?id=1204 思路分析:由于题目数据较弱,使用暴力搜索:对于所有查找的单词建立一棵字典树,在图中的每个坐标,往8个方向搜索查找即可: 需要注意 ...
- [POJ 1204]Word Puzzles(Trie树暴搜&AC自己主动机)
Description Word puzzles are usually simple and very entertaining for all ages. They are so entertai ...
- poj 1318 Word Amalgamation
Word Amalgamation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9968 Accepted: 4774 ...
- POJ 1496
#include <iostream> #include <string> using namespace std; int fac(int num); int C(int n ...
- poj1496 Word Index / poj1850 Code(组合数学)
poj1850 Code 题意:输出若干个给定的字符串($length<=10$)在字典序中的位置,字符串中的字母必须严格递增. 读取到非法字符串时,输出“0”,终止程序.(poj1496:继续 ...
随机推荐
- 用python来调试网络程序
需要联调的程序,沟通联调起来总是各种麻烦,如果自己能写个简单一点的“测试机”,事情就很easy了:或者有时候想做“中间人”,看看网路上到底传些什么.前面写了串口的测试机,今天尝试了一下UDP的. im ...
- centos卸载console-kit-da
最近发现系统多出来 很多 console-kit-da 及它的子进程 占用了不少资源 which console-kit-da(很奇怪 为什么找不到执行文件) rpm -qa | grep -i co ...
- JSP+JavaBean+Servlet+Oracle新增功能中对Date类型的字段的处理
Oracle库中userinfo表borth字段是Date类型,age年纪字段是int类型.age字段要根据borth来自动计算 先说一下我遇到的问题: insert into的时候遇到日期转换类型错 ...
- TortoiseSVN 过滤文件(包括已提交和未提交)
一:svn 设置过滤文件方式 1.选中需要过滤的文件夹或者文件---右键---TortoiseSVN---Add to Ignore list(如果不显示说明该目录已经被添加) 2.在当前工作区域 不 ...
- mysql 某周的起始和结束日期
转自:http://bbs.csdn.net/topics/370096126 t_table有数据如下:year Week2011 22011 32011 42011 ...
- easyUI 树的上下文菜单
一.属性:onContextMenu onContextMenu: function(e,node){ e.preventDefault(); $(this).tree('select',node.t ...
- 修改输入框placeholder文字默认颜色-webkit-input-placeholder
html5为input添加了原生的占位符属性placeholder,高级浏览器都支持这个属性,例如: <input type="text" placeholder=" ...
- 网页js,DIV全屏布局
<script type="text/javascript"> $(document).ready(function(){ findDimensions(); }); ...
- Effective Objective-C 2.0 — 第二章 对象、消息、运行期 - 第六条:理解“属性”这一概念
开发者通过对象来 存储并传递数据. 在对象之间传递数据并执行任务的过程就叫做“消息传递”. 这两条特性的工作原理? Objective-C运行期环境(Objective-C runtime) ,提供了 ...
- json_decode
<?php $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}' ...