- 博客(22)
- 资源 (6)
- 收藏
- 关注
原创 通过串口连接两台虚拟机
实验环境1.VirtualBox 6.0.101.windows10作为宿主主机2.Debian10 x86 2台,一台作为开发机,另一台作为目标机器(注意:目标机通过串口连接开发机器)步骤1.在开发机器中,设置串口。首先启用串口,选择串口编号为COM1,模式选择主机管道,去掉“连接至现有通道或套接字”(即表示创建管道)。“路径/地址§”栏键入"\.\pipe\vboxpipe",如...
2019-10-18 10:53:39
1464
原创 【numpy】tile函数解析
tile函数源代码位于numpy-master\numpy\lib\shape_base.py文件中代码如下:def tile(A, reps): try: tup = tuple(reps) except TypeError: tup = (reps,) d = len(tup) if all(x == 1 for x in
2015-12-14 10:37:45
1242
原创 【HDOJ】【1021】Fibonacci Again
一道简单题,一次通过。简单说下思路吧,受到1005题的启发,猜测这道题可能存在周期,那么先用常规代码,计算并打印100以内的结果,观察是否存在周期,发现周期为8,那么问题就简单化了,不需要计算所有结果,只需要利用周期。在周期内,余数为12022101,只有2、6位置上的数可以被3整除,问题解决完毕。#include #include /* run this program usi
2015-11-03 10:49:41
275
原创 【HDOJ】【1019】Least Common Multiple
此题计算多个数值的最小公倍数,利用先求最大公约数间接求解最小公倍数的时候,由于通常会先将两个数相乘,然后再除的形式,导致先做乘法的位置溢出,经过多次提交,发现此问题。另外,此题还存在数值中有0的情况,以及只有一个数值的情况。注意到这些问题后,此题通过。#include #include #include /* run this program using the con
2015-11-02 18:03:31
453
原创 【HDOJ】【1017】A Mathematical Curiosity
被格式坑得飞起,看了好久好久才通过。使用固定大小的数组,代码显得比较low,还可以继续进行优化。
2015-10-29 14:36:10
272
原创 【HDOJ】【1014】Uniform Generator
前后提交了6次,才AC。这些提示都是Presentation Error,说明是格式的错误。题目中的第三个测试用例,最初的代码总是判断出错,原因是迭代值已经超过int型的最大数,所以将类型改为__int64。另外,此题的输出中,每个用例的输出之间有一个空行,所以加了一个\n,问题解决。#include #include #include /* run this program
2015-10-28 17:35:18
422
原创 【HDOJ】【1013】Digital Roots
很简单的一道题,题目叙述也很清晰。Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digi
2015-10-28 15:46:57
255
原创 【HDOJ】【1012】u Calculate e
这次代码质量不高,对于前几个情况直接打印,显得比较low。从n==3开始,进行的计算。#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char
2015-10-28 13:56:21
277
原创 【HDOJ】【1008】Elevator
简单题,一次通过。思路:没什么可说的,纯计算。代码:#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) { int
2015-10-27 11:26:05
219
原创 【HDOJ】【1005】Number Sequence
经过无数次提交,终于在一个阳光明媚的早晨通过了。遗憾的是,通过是在扫了一眼Discuess中的讨论得到的启示,运用了周期是49这个特性,但是现在也不懂是怎么得出周期是49的,还请各位牛人指点。说下思路吧:看到题目,首先想到递归,3分钟搞定代码,本地测试,提交,看到运行结果提示,栈溢出。估计应该是递归造成的,同时也想到OJ使用的测试用例中,n过大导致。接着想到了用循环来计算,提交,继续提示超
2015-10-27 10:21:48
305
原创 【HDOJ】【1004】Let the Balloon Rise
非常简单的一道题,在GCC下调试。方法比较笨,3次通过,记录一下。直接上代码#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */typedef struct Node{ in
2015-10-26 17:10:06
229
原创 Python内建函数isinstance无法准确判断bool与int类型
首先创建一个元组a>>> a = (1,True,'abc')然后使用系统内建函数判断数据类型,如下:>>> isinstance(a[0],int)True>>> isinstance(a[1],int)True>>> isinstance(a[2],int)False显然isinstance函数无法准确判断整型1与布尔型True,系统默认将True认为是数字1。
2015-07-08 15:25:58
2870
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人