一:需求分析 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
out< "please input the number of the nodes"<<endl cin>>nodesNum cout<<"please input the graph"<<endl for( i = 1 i<=nodesNum i++) for( j = 1 j <= nodesNum j++) cin>>graph[i][j] */
上传时间: 2013-11-29
上传用户:libinxny
最大李雅普诺夫指数的计算 该函数用来计算时间序列的最大Lyapunov 指数--Wolf 方法 % m: 嵌入维数 % tau:时间延迟 % data:时间序列 % N:时间序列长度 % P:时间序列的平均周期,选择演化相点距当前点的位置差,即若当前相点为I,则演化相点只能在|I-J|>P的相点中搜寻
上传时间: 2013-12-10
上传用户:hewenzhi
该软件能很好地实现数控机床上的G00,G01,G02,G03指令(其中G02,G03画圆弧插补指令里的I,J是表示圆弧起点相对于圆心的矢量,即矢量方向为圆心指向起点),除此之外,该软件能控制X380卡驱动步进电机按仿真图轨迹走线,效果理想。
上传时间: 2014-01-11
上传用户:hewenzhi
动态规划的方程大家都知道,就是 f[i,j]=min{f[i-1,j-1],f[i-1,j],f[i,j-1],f[i,j+1]}+a[i,j] 但是很多人会怀疑这道题的后效性而放弃动规做法。 本来我还想做Dijkstra,后来变了没二十行pascal就告诉我数组越界了……(dist:array[1..1000*1001 div 2]...) 无奈之余看了xj_kidb1的题解,刚开始还觉得有问题,后来豁然开朗…… 反复动规。上山容易下山难,我们可以从上往下走,最后输出f[n][1]。 xj_kidb1的一个技巧很重要,每次令f[i][0]=f[i][i],f[i][i+1]=f[i][1](xj_kidb1的题解还写错了)
上传时间: 2014-07-16
上传用户:libinxny
一、问题的提出: 某厂根据计划安排,拟将n台相同的设备分配给m个车间,各车间获得这种设备后,可以为国家提供盈利Ci j(i台设备提供给j号车间将得到的利润,1≤i≤n,1≤j≤m) 。问如何分配,才使国家得到最大的盈利L 二.算法的基本思想: 利用动态规划算法的思想,设将i台设备分配给j-1个车间,可以为国家得到最大利润Li (j-1)(1≤i≤n,1≤j≤m),那么将这i台设备分配给j个车间,第j个车间只能被分配到0~i台,所以我们只要算出当第j个车间分配到t(0<=t<=i)台时提供的最大利润Lt(j-1)+C(i-t)j,
标签:
上传时间: 2016-09-19
上传用户:希酱大魔王
遥控解码通过电脑串口显示 /* 晶振:11.0569MHz */ #include <REGX52.h> #define uchar unsigned char uchar data IRcode[4] //定义一个4字节的数组用来存储代码 uchar CodeTemp //编码字节缓存变量 uchar i,j,k //延时用的循环变量 sbit IRsignal=P3^2 //HS0038接收头OUT端直接连P3.2(INT0) /**************************延时0.9ms子程序**********************/ void Delay0_9ms(void) {uchar j,k for(j=18 j>0 j--) for(k=20 k>0 k--) } /***************************延时1ms子程序**********************/ void Delay1ms(void) {uchar i,j for(i=2 i>0 i--) for(j=230 j>0 j--) }
标签: uchar unsigned 11.0569 include
上传时间: 2013-12-12
上传用户:Breathe0125
汉诺塔!!! Simulate the movement of the Towers of Hanoi puzzle Bonus is possible for using animation eg. if n = 2 A→B A→C B→C if n = 3 A→C A→B C→B A→C B→A B→C A→C
标签: the animation Simulate movement
上传时间: 2017-02-11
上传用户:waizhang
矩阵运算.输入一个矩阵,输入错误时报错.函数参数;待输入实型矩阵array,array的行列数i,j 返回值:0,表示输入错误;1,表示正确输入
上传时间: 2014-01-20
上传用户:二驱蚊器