摘要: 一、实验要求 1. 提取左公因子或消除左递归(实现了消除左递归) 2. 递归求First集和Follow集 其它的只要按照课本上的步骤顺序写下来就好(但是代码量超多...),下面我贴出实验的一些关键代码和算法思想。 二、基于预测分析表法的语法分析 2.1 代码结构 2.1.1 Grammar类 功能 阅读全文
posted @ 2018-10-31 18:08 Chris-Zhang 阅读(37158) 评论(5) 推荐(5) 编辑
摘要: 如果用Ubuntu是vmware安装的虚拟机,只需要点击编辑->虚拟网络编辑器->NAT设置->DNS设置 把DNS服务器地址改为下图即可,无需重启,立即生效 阅读全文
posted @ 2018-10-11 13:30 Chris-Zhang 阅读(8741) 评论(1) 推荐(0) 编辑
摘要: #include #include #include #define N 1000 //物品个数 #define M 100000000 //所有物品可能的最大价值 int m[N],c[N],w[N],f[M]; int V; int max(int a,int b){return a>b?a:b;} void ZeroOnePack(int cost,int wei... 阅读全文
posted @ 2018-09-17 18:49 Chris-Zhang 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 题目链接 There are N children in kindergarten. Miss Li bought them N candies. To make the process more interesting, Miss Li comes up with the rule: All th 阅读全文
posted @ 2018-09-16 10:16 Chris-Zhang 阅读(250) 评论(0) 推荐(0) 编辑
摘要: (1)Linux的发展史: https://baijiahao.baidu.com/s?id=1596055086682621768&wfr=spider&for=pc 比较流行的几款发行版:RHEL(红帽企业版Linux),CentOS(社区企业操作系统),Ubantu,Fedora,Debian 阅读全文
posted @ 2018-09-14 12:01 Chris-Zhang 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 在安装Ubuntu -18.04.1之前需要预装VMware workstation 一、Ubuntu -18.04.1下载 官方下载地址: http://mirrors.huaweicloud.com/repository/ubuntu-releases/18.04.1/ubuntu-18.04. 阅读全文
posted @ 2018-09-12 22:50 Chris-Zhang 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 输入 每个测试点(输入文件)有且仅有一组测试数据。 每组测试数据的第1行为两个整数N和L,分别表示总共贴上的海报数量和宣传栏的宽度。 每组测试数据的第2-N+1行,按照贴上去的先后顺序,每行描述一张海报,其中第i+1行为两个整数a_i, b_i,表示第i张海报所贴的区间为[a_i, b_i]。 对于 阅读全文
posted @ 2018-09-12 15:26 Chris-Zhang 阅读(941) 评论(0) 推荐(0) 编辑
摘要: 输入 每个测试点(输入文件)有且仅有一组测试数据。 每组测试数据的第1行为一个整数N,意义如前文所述。 每组测试数据的第2行为N个整数,分别描述每种商品的重量,其中第i个整数表示标号为i的商品的重量Pi。 每组测试数据的第3行为一个整数Q,表示小Hi进行的操作数。 每组测试数据的第N+4~N+Q+3 阅读全文
posted @ 2018-09-11 19:13 Chris-Zhang 阅读(1381) 评论(0) 推荐(1) 编辑
摘要: Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to 阅读全文
posted @ 2018-05-02 23:32 Chris-Zhang 阅读(222) 评论(0) 推荐(0) 编辑
摘要: Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama 阅读全文
posted @ 2018-04-26 09:10 Chris-Zhang 阅读(316) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You m 阅读全文
posted @ 2018-04-24 23:17 Chris-Zhang 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 海边躺着一排咸鱼,一些有梦想的咸鱼成功翻身(然而没有什么卵用),一些则是继续当咸鱼。一个善良的渔夫想要帮这些咸鱼翻身,但是渔夫比较懒,所以只会从某只咸鱼开始,往一个方向,一只只咸鱼翻过去,翻转若干只后就转身离去,深藏功与名。更准确地说,渔夫会选择一个区间[L,R],改变区间内所有咸鱼的状态,至少翻转 阅读全文
posted @ 2018-04-22 00:05 Chris-Zhang 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 今天做python作业的时候,老师给出一段代码让我们判断能不能顺利执行(直接在IDLE上执行一下就知道了嘛),不能执行的话说明原因并修改 老师还贴心的给了个提示:根据Python 3.6.4的文档(documentation),我们发现functools模块中的reduce()函数还可以有第三个可选 阅读全文
posted @ 2018-04-21 10:59 Chris-Zhang 阅读(1284) 评论(0) 推荐(0) 编辑
摘要: Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which the 阅读全文
posted @ 2018-04-20 20:53 Chris-Zhang 阅读(277) 评论(0) 推荐(0) 编辑