The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition
标签: government streamline important alphabet
上传时间: 2015-06-09
上传用户:weixiao99
电力系统在台稳定计算式电力系统不正常运行方式的一种计算。它的任务是已知电力系统某一正常运行状态和受到某种扰动,计算电力系统所有发电机能否同步运行 1运行说明: 请输入初始功率S0,形如a+bi 请输入无限大系统母线电压V0 请输入系统等值电抗矩阵B 矩阵B有以下元素组成的行矩阵 1正常运行时的系统直轴等值电抗Xd 2故障运行时的系统直轴等值电抗X d 3故障切除后的系统直轴等值电抗 请输入惯性时间常数Tj 请输入时段数N 请输入哪个时段发生故障Ni 请输入每时段间隔的时间dt
上传时间: 2015-06-13
上传用户:it男一枚
一:需求分析 1. 问题描述 魔王总是使用自己的一种非常精练而抽象的语言讲话,没人能听懂,但他的语言是可逐步解释成人能听懂的语言,因为他的语言是由以下两种形式的规则由人的语言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在这两种形式中,从左到右均表示解释.试写一个魔王语言的解释系统,把 他的话解释成人能听得懂的话. 2. 基本要求: 用下述两条具体规则和上述规则形式(2)实现.设大写字母表示魔王语言的词汇 小写字母表示人的语言的词汇 希腊字母表示可以用大写字母或小写字母代换的变量.魔王语言可含人的词汇. (1) B --> tAdA (2) A --> sae 3. 测试数据: B(ehnxgz)B 解释成 tsaedsaeezegexenehetsaedsae若将小写字母与汉字建立下表所示的对应关系,则魔王说的话是:"天上一只鹅地上一只鹅鹅追鹅赶鹅下鹅蛋鹅恨鹅天上一只鹅地上一只鹅". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鹅 | 追 | 赶 | 下 | 蛋 | 恨 |
上传时间: 2014-12-02
上传用户:jkhjkh1982
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
标签: represented integers group items
上传时间: 2016-01-17
上传用户:jeffery
VisualC++通信编程工程实例精解 \Chapter 2 \Example 1 MSCOMM控件编程实例 \Example 2 基于Windows API的虚拟终端实现 \Example 3 基于CSerialPort的串口多线程通信框架 \调试工具\串口调试助手 \Chapter 3 \Example 4 Winsock API编程技术——基于Winsock的聊天室程序 \Example 5 CAsyncSocket编程技术——基于CAsyncSocket的局域网通信程序 \Example 6 CSocket编程技术——基于CSocket的局域网聊天室程序 \扩充实例 基于CSocket的网络版中国象棋 \调试工具\TCPUDP调试助手 \Chapter 4 \Example 7 访问远程数据库MS SQLServer实例 \Chapter 5 \Example 8 以RS View32为服务器的OPC客户端编程 \Example 9 一个OPC客户端监视程序 \Chapter 6 \Example 10 一个封装的Modem AT命令操作类的快速拨号程序 \Chapter 7 \Example 11 GSM和GPRS应用实例 \扩充实例 基于CSocket的GPRS数据中心程序 \调试工具和文档\TCPUDP调试助手 MC55_ATC_V02.06.pdf TCP使用方法.doc 常用SMS指令一览表.pdf
标签: Example VisualC Chapter Windows
上传时间: 2016-03-25
上传用户:赵云兴
编译原理的教学课件,国防科技大学出版的书籍的配套课件,版本很好,对于自学很有用,这是6-10章。
上传时间: 2016-03-28
上传用户:cuiyashuo
功能:时钟DS1302的读写 hd7279显示显示分 小时 说明: (1)每次上电时,必须把秒寄存器高位设置为0,时钟才能走时 (2)如果每次需要写入数据和时钟日历信息,须将"写保护"寄存器设置成为0 (3)P0低4位接段码,高4位接位选,从DS1302中读出来的是BCD码 (4)TS=1010,DS=01,RS=01(在Vcc1与Vcc2之间接2K电阻) (5)初始时间设置为05年 6月 10日 星期1 8:
上传时间: 2016-06-16
上传用户:三人用菜
linux设备驱动第三版中文,基于2.6.18.10所写,有需要的朋友请下载!
上传时间: 2013-12-14
上传用户:q123321
将魔王的语言抽象为人类的语言:魔王语言由以下两种规则由人的语言逐步抽象上去的:α-〉β1β2β3…βm ;θδ1δ2…-〉θδnθδn-1…θδ1 设大写字母表示魔王的语言,小写字母表示人的语言B-〉tAdA,A-〉sae,eg:B(ehnxgz)B解释为tsaedsaeezegexenehetsaedsae对应的话是:“天上一只鹅地上一只鹅鹅追鹅赶鹅下鹅蛋鹅恨鹅天上一只鹅地上一只鹅”。(t-天d-地s-上a-一只e-鹅z-追g-赶x-下n-蛋h-恨)
上传时间: 2013-12-19
上传用户:aix008
谭浩强C语言word版 1 C语言概述 2 1.1 C语言的发展过程 2 1.2 当代最优秀的程序设计语言 2 1.3 C语言版本 2 1.4 C语言的特点 3 1.5 面向对象的程序设计语言 3 1.6 C和C++ 3 1.7 简单的C程序介绍 4 1.8 输入和输出函数 5 1.9 C源程序的结构特点 6 1.10 书写程序时应遵循的规则 6 1.11 C语言的字符集 6 1.12 C语言词汇 7 1.13 Turbo C 2.0集成开发环境的使用 8 1.13.1 Turbo C 2.0简介和启动 8 1.13.2 Turbo C 2.0集成开发环境 8 1.13.3 File菜单 9 1.13.4 Edit菜单 10 1.13.5 Run菜单 11 1.13.6 Compile菜单 12 1.13.7 Project菜单 13 1.13.8 Options菜单 14 1.13.9 Debug菜单 18 1.13.10 Break/watch菜单 19 1.13.11 Turbo C 2.0的配置文件 20
上传时间: 2014-01-20
上传用户:奇奇奔奔