# 题意 给定两个整数l,r,求在[l,r]区间内距离最近的一对相邻质数,和距离最远的一对相邻质数 l,r ∈ [1 , 231-1] 其中r-l <= 1e6 # 题解 l,r的范围很大,大约是2e9 线性算法也无法求出[1,r]的所有质数,但是r-l的范围小, 任何一个合数必定会包含一个不超过 ...
分类:
其他好文 时间:
2020-03-30 23:26:05
阅读次数:
70
var startX = startY = endX = endY = 0; var body = document.getElementById("dind"); body.addEventListener('touchstart', function(event){ var touch = ev ...
分类:
Web程序 时间:
2020-03-27 11:16:33
阅读次数:
139
一、RIP协议概述 RIP是Routing Information Protocol(路由信息协议)的简称。 RIP是一种基于距离矢量(Distance-Vector)算法的路由协议。 RIP协议适用于中小型网络,分为RIPv1和RIPv2。 RIP支持水平分割、毒性逆转和触发更新等工作机制防止路由 ...
分类:
其他好文 时间:
2020-03-25 23:47:21
阅读次数:
215
#include<iostream> #include<cmath> using namespace std; typedef double (*fpoint)(double x); //新定义的函数类型,里边有一个double变量 double fun1(double x){ const int ...
分类:
其他好文 时间:
2020-03-25 10:37:03
阅读次数:
79
LeetCode 1385. Find the Distance Value Between Two Arrays两个数组间的距离值【Easy】【Python】【暴力】 Problem "LeetCode" Given two integer arrays and , and the integer ...
分类:
编程语言 时间:
2020-03-22 10:27:21
阅读次数:
80
Q:给定两个单词word1和word2,请计算将word1转换为word2至少需要多少步操作。 你可以对一个单词执行以下3种操作: a)在单词中插入一个字符 b)删除单词中的一个字符 c)替换单词中的一个字符 A: 若 i == j,则意为着不需额外操作,则F(i,j) 显然 等于 F(i 1,j ...
分类:
其他好文 时间:
2020-03-20 18:29:33
阅读次数:
71
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: ...
分类:
其他好文 时间:
2020-03-16 23:35:41
阅读次数:
72
ML Agents(二)创建一个学习环境 一、前言 上一节我们讲了如何配置ML Agents环境,这一节我们创建一个示例,主要利用Reinforcement Learning(强化学习)。 如上图,本示例将训练一个球滚动找到随机放置的立方体,而且要避免从平台上掉下去。 本示例是基于ML Agents ...
分类:
其他好文 时间:
2020-03-16 23:11:42
阅读次数:
67
``` void findLine(const std::string file,std::double_t min_distance_value = 100.0) { //https://github.com/opencv/opencv/blob/master/modules/imgproc/sr... ...
分类:
其他好文 时间:
2020-03-15 13:03:21
阅读次数:
255
最接近原点的K个点。题意是给一些点的坐标(以二维数组表示)和一个数字K。求距离最靠近原点的前K个点。例子, Example 1: Input: points = [[1,3],[-2,2]], K = 1 Output: [[-2,2]] Explanation: The distance betw ...
分类:
其他好文 时间:
2020-03-13 13:00:40
阅读次数:
59