自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 第七章:语法制导翻译和中间代码

(垃圾博主随心情更新。。。。)1.中间代码是介于源语言程序和什么之间的一种代码?( )A. 源代码B. 机器语言C. 汇编语言D. 目标代码2. 在编译程序中与生成中间代码的目的无关的是( )。A. 便于目标代码优化B. 便于存储空间的组织C. 便于目标代码的移植D.便于编译程序的移植3. 逆波兰表示法表示表达式时无须使用括号。正确错误...

2019-03-27 22:19:24 2396 3

原创 编译原理第五章语法分析课后题

(先补到这里,后面如果有需要的话,垃圾博主还会回来继续更的。。。)5.1 递归子程序法属于()语法分析方法A. 自顶向下B. 自底向上C. 自左向右D. 自右向左5.2 采用确定的自顶向下分析时,必须()A. 消除左递归B. 消除右递归C. 避免回溯D. 提取左公因子5.3 自上而下语法分析的主要分析动作是A. 推导B. 移进C. 归约D...

2019-03-17 11:51:38 10891 2

原创 编译原理第三章有穷自动机与正则表达式理论基础课后题

(垃圾博主来填坑啦。。。)3.1 某个语言,它能用正规表达式表示,但是不能使用任何正规文法表示,这个语言必然是()。A.含二义性语言B. 1型文法所对应的语言C. 既含左递归又含右递归的语言D. 不存在的语言3.2 词法分析器的另一个名称是()A. 分析器B. 扫描器C. 划分处理器D. 词法探索器3.3 面对众多的源语言的词法分析处理,总体上,超前读...

2019-03-17 11:31:32 5559

原创 编译原理第二章上下文无关文法和形式语言课后题

2.1 对于文法G[Z],已知u是句型,则判断()是正确的A 只要使用规范推导,无论如何一定可以从Z推导出uB 只要依据产生式进行归约,则u一定可以归约成ZC 上面的A和B都是对的D 上面的A和B都是错的2.2 由“非终结符-->符号串”这种产生式构成的文法是()A 0型语法B 1型文法C 2型文法D 3型文法2.3 二义文法是指()A 对应于两...

2019-03-17 11:21:55 10492 8

原创 编译原理第一章编译系统概述课后题

1.1 编译过程中,语法分析器的任务不包括() A. 分析单词是怎样构成的 B. 分析单词串是如何构成语句和说明的 C. 分析语句和说明是如何构成程序的 D. 分析程序的结构1.2 编写一个计算机高级语言的源程序后,到正式上机运行之前,一般要经过()这几步 a、编辑 b、编译 c、连接 d、运行 A. abcd B. abc...

2018-12-20 21:03:45 10240 2

原创 poj-2398 Toy Storage (排序+叉积)

Toy Storage POJ - 2398 Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangular box to put his toys in. Unfortuna...

2018-07-27 14:47:18 217

原创 计算几何学习——多边形面积

计算凸多边形的面积:可以从第一个顶点出发将凸多边形分成n-2个三角形,按照顺时针或者逆时针的方向给出多边形的每个顶点的坐标,通过计算三角形的面积来求得整个凸多边形的面积。 /* 两个向量的叉积也就是这两个向量所组成的平行四边形的面积;*/double ConvexPoygonArea(Point* p, int n){ double area = 0; f...

2018-06-11 17:10:51 791 2

原创 点积与叉积

1. 向量的点乘:向量点乘是其各个分量乘积的和几何意义:点乘的结果是一个标量,等于向量大小与夹角的cos值的乘积。                    a•b = |a||b|cosθ                如果a和b都是单位向量,那么点乘的结果就是其夹角的cos值。                    a•b = cosθ交换律:分配律:结合律:  其中m是实数。2. 向量叉乘:两个...

2018-05-30 12:26:02 31948 2

原创 codeforces 922B

B. Magic Foresttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImp is in a magic forest, where xorangles grow (wut?)A xorangle of order n is such a...

2018-04-11 21:07:04 176

原创 codeforces 899B

B. Months and Yearstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEverybody in Russia uses Gregorian calendar. In this calendar there are 31 days ...

2018-04-07 16:31:38 144

原创 数组交换

设a[0:n-1]是有n个元素的数组, k(0<=k<=n-1) 是一个非负整数。试设计一个算法将子数组a[0:k-1]  与 a[k:n-1] 换位。要去算法在最坏情况下耗时 O(n),且只用到O(1)的辅助空间。#include<bits/stdc++.h>using namespace std;const int maxn = 10000;void rev1(i...

2018-04-03 21:16:04 995

原创 CodeForces 924A

A. Mystical Mosaictime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a rectangular grid of n rows of m initially-white cells each.Arkady perf...

2018-03-28 21:11:47 216

原创 Codeforces 937A

A. Olympiadtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe recent All-Berland Olympiad in Informatics featured n participants with each scoring...

2018-02-26 02:33:20 315

原创 Codeforces 940-A

A. Points on the linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe've got no test cases. A big olympiad is coming up. But the problemsetters' ...

2018-02-25 22:10:59 256

原创 CodeForces 935B

B. Fafa and the Gatestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo neighboring kingdoms decided to build a wall between them with some gates...

2018-02-21 23:12:23 261

原创 CodeForces 935A(求因数个数)

A. Fafa and his Companytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFafa owns a company that works on huge projects. There are n employees in Fa...

2018-02-21 23:04:24 342

原创 Codeforces 922-C

Codeforces 922-CC. Cave Paintingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImp is watching a documentary about cave painting.Some numbers, car...

2018-02-08 03:49:21 302

原创 设计一个名为Circle2D的类

import java.util.Scanner;public class Main { private static Scanner input; public static void main(String[] args) { input = new Scanner(System.in); System.out.print("请输入圆的圆心坐标X,Y和圆的半径:");

2017-09-21 20:44:59 2722

原创 设计一个名为MyPoint的类

package main;import java.util.Scanner;public class Second{ private static Scanner input;public static void main(String args[]){ input = new Scanner(System.in); MyPoint op1 = new

2017-09-21 19:40:40 7661

转载 java中格式化输出数字的方法

作为一个初学Java的小白,对Java中很多的地方只有初步的了解。碰巧在写一道需要注意数据的格式化输出的题目时,在百度了一下之后发现了这种方法,就来记录一下。主要使用的类:java.text.DecimalFormathttp://www.jb51.net/article/45892.htm计算正五边形的面积和周长。从键盘输入一个数作为正五边形的边长,计算并输出

2017-09-05 21:12:24 852

原创 归并求逆序对

求这个逆序对只需要在归并排序的代码中加一句即可。感觉自己有点说不清楚,随手附上别人的详细解释,请戳:详细介绍#include#include#include using namespace std;int a[1000000];int b[1000000];int sum = 0;void merge(int l, int mid, int r){ int p

2017-08-17 21:48:10 261

原创 归并排序

日常保存代码系列。#include#includeusing namespace std;int a[1000000];int b[1000000];void merge(int l, int mid, int r){ int p1 = l; int p2 = mid + 1; for(int i = l; i <= r; i++) { if(p1 r || (a

2017-08-17 17:57:32 128

原创 快速排序

没有啥要说的,日常保留代码系列。#include#include#includeusing namespace std;int a[1000000];void quick_sort(int l, int r){ int i = l; int j = r; int mid = (l + r) / 2; int x = a[mid]; while(i <= j) {

2017-08-17 17:55:13 122

转载 紫书上的例题,关于BFS

不知道该说些啥#include#include#include#includeusing namespace std;struct Node { int r, c, dir; // 站在(r,c),面朝方向dir(0~3分别表示N, E, S, W) Node(int r=0, int c=0, int dir=0):r(r),c(c),dir(dir) {}};co

2017-08-04 19:35:31 251

转载 Oil Deposits

紫书上面的例题一个关于油田联通块的问题,书上用的是递归的dfs搜索,悄悄记录一下*     *     *     *   @*     @   @   *   @*     @    *    *   @@   @   @   *  @@   @    *    *  @#include#includeconst int maxn = 100 + 5;cha

2017-08-03 17:28:30 144

原创 Bear and Different Names

D - Bear and Different Names In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a na

2017-07-28 15:53:09 267

原创 设计一个名为Account的类

设计一个名为Account的类: * 一个名为id的int类型私有数据域(默认值为0) * 一个名为balance的double类型私有数据域(默认值为0) * 一个名为annualInterestRate的double类型私有数据域存储当前利率(默认值为0)。假设所有的账户都有相同的利 率。 * 一个名为dateCreated的Date类型的私有数据域,存储账户的开户日期。

2017-07-26 08:59:08 12280 3

原创 暑假第一周D,E,F题

D - Valued KeysYou found a mysterious function f. The function takes two strings s1 and s2. These strings must consist only of lowercase English letters, and must be the same length.The output o

2017-07-22 13:42:57 456

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除