题意 ​ 题目主要说的是,有两只青蛙,在两个石头上,他们之间也有一些石头,一只青蛙要想到达另一只青蛙所在地方,必须跳在石头上.题目中给出了两只青蛙的初始位置,以及剩余石头的位置,问一只青蛙到达另一只青蛙所在地的所有路径中的"the frog distance"中的最小值. ​ 解释一下"the frog distance": 题目中给出了一段解释"The frog distance (humans also call it minimax distance…
//求两个日期之间的相差天数 function daysBetween(DateOne, DateTwo) { var OneMonth = DateOne.substring(5, DateOne.lastIndexOf('/')); var OneDay = DateOne.substring(DateOne.length, DateOne.lastIndexOf('/') + 1); var OneYear = DateOne.substring(0, DateOne.indexOf('/…
<?php /** * 求两个日期之间相差的天数 * (针对1970年1月1日之后,求之前可以采用泰勒公式) * @param string $day1 * @param string $day2 * @return number */ function diffBetweenTwoDays ($day1, $day2) { $second1 = strtotime($day1); $second2 = strtotime($day2); if ($second1 < $second2) {…
地铁修建 201703-4 这题就是最短路的一种变形,不是求两点之间的最短路,而是求所有路径中的最长边的最小值. 这里还是使用d数组,但是定义不同了,这里的d[i]就是表示从起点到i的路径中最长边中的最小值. 在松弛的时候,注意是d[i]>max(d[u],cost),max保证了是所有路径中的最长边,>号保证了是最小值. 这里使用前向星+优先队列对dijikstra算法进行了优化. //#include <iostream> //#include<cstdio> //…
这是在fcc上的中级算法中的第一题,拉出来的原因并不是因为有什么好说的,而是我刚看时以为是求两个数字的和, 很显然错了.我感觉自己的文字理解能力被严重鄙视了- -.故拉出来折腾折腾. 要求: 给你一个包含两个数字的数组.返回这两个数字和它们之间所有数字的和. 最小的数字并非总在最前面. 思路:在正确理解要求之后,有三四种方法可以来解决这个问题: 1.就是提前给的提示Math.min()和Math.max(). 感兴趣可以看看. Math.max():https://developer.mozil…
键盘录入多个城市: 城市1,城市2,城市3  以 ### 结束输出然后再键盘录入各个城市之间的距离:  格式如下:0,12,4512,0,2245,22,0### 然后按照输入的两个城市,求得两个城市之间的距离:城市1 城市2 代码如下:package com.johnson.test; import java.util.ArrayList;import java.util.HashMap;import java.util.Map.Entry;import java.util.Scanner;i…
题目链接:https://vjudge.net/problem/POJ-2253 思路: 从一号到二号石头的所有路线中,每条路线中都个子选出该路线中两点通路的最长距离,并在这些选出的最长距离选出最短路的那个距离X, 就是青蛙距离,即青蛙至少能跳X米,才能安全的到达二号,因为什么,再看看第一句话. 再想,我们知道,djikstra中的价值数组存的是从u点到其他所有点的最短距离,way[ 1 ] 是u到1的最短距离, way[ x ] 是u到x的最短距离, 我们知道djikstra的时间复杂度是O(…
The Tourist Guide Mr. G. works as a tourist guide. His current assignment is to take some tourists from one city to another. Some two-way roads connect the cities. For each pair of neighboring cities there is a bus service that runs only between thos…
  Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28802   Accepted: 9353 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but si…
package Test; public class test6 { public static void main(String[] args) { // TODO Auto-generated method stub Mypoint mypoint1 = new Mypoint(1,1); Mypoint mypoint2 = new Mypoint(2,2); double distance = Mypoint.getDistance(mypoint1, mypoint2); System…
题意 给你n个点,1为起点,2为终点,要求所有1到2所有路径中每条路径上最大值的最小值. 思路 不想打最短路 跑一边最小生成树,再扫一遍1到2的路径,取最大值即可 注意g++要用%f输出!!! 常数巨大的丑陋代码 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <math.h> # include <al…
#include<cstdio> #include<algorithm> #include<cstring> #define N 200005 using namespace std; int buf1[N],buf2[N],sa[N],rnk[N],buc[N],n,height[N],ans,belong[N]; char s[N]; void suffix_sort() { ; ;i<m;i++) buc[i]=; ;i<=n;i++) buc[x[i…
点击打开链接 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21653   Accepted: 7042 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visi…
-->Frogger 中文翻译 Descriptions: 湖中有n块石头,编号从1到n,有两只青蛙,Bob在1号石头上,Alice在2号石头上,Bob想去看望Alice,但由于水很脏,他想避免游泳,于是跳着去找她.但是Alice的石头超出了他的跳跃范围.因此,Bob使用其他石头作为中间站,通过一系列的小跳跃到达她.两块石头之间的青蛙距离被定义为两块石头之间所有可能路径上的最小必要跳跃距离,某条路径的必要跳跃距离即这条路径中单次跳跃的最远跳跃距离.你的工作是计算Alice和Bob石头之间的青蛙距…
Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 24879   Accepted: 8076 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her,…
题意: 题目撰写者的英语真是艰难晦涩,看了别人题解,才知道这题题意. 两个forger 一个froger 要蹦到另外一个froger处,他们的最短距离是这样定义的 : The frog distance (humans also call it minimax distance) between two stones therefore is defined as the minimum necessary jump range over all possible paths between t…
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimming and instead rea…
题目链接 : http://poj.org/problem?id=2253: 思路:这个题主要是理解了意思就行,题目意思是有两只青蛙和若干块石头,现在已知这些东西的坐标,两只青蛙A坐标和青蛙B坐标是第一个和第二个坐标,现在A青蛙想要到B青蛙那里去,并且A青蛙可以借助任意石头的跳跃,而从A到B有若干通路,问从A到B的所有通路上的最大边并且这个最大边在所有通路上最小  例如  :1(6)4(3)2代表1到4之间的边为6,  4到2之间的边为3,那么该条通路跳跃范围(两块石头之间的最大距离)为 6, …
题目链接 POJ-3608 Bridge Across Islands 题意 依次按逆时针方向给出凸包,在两个凸包小岛之间造桥,求最小距离. 题解 旋转卡壳的应用之一:求两凸包的最近距离. 找到凸包 p 的 y 值最小点 yminP 和 q 的 y 值最大点ymaxQ,然后分别做切线如图. 那么\(AC\times AD> AC\times AB\)则说明B还不是离AC最近的点,所以++ymaxQ. 否则用 \(AC\) 和 \(BD\) 两个线段的距离更新最近距离,并且++yminP,即考察P…
1. 目前在项目中,遇到一个需求不会做,就是要计算两个城市之间的距离,而这两个城市的输入是可变的,如果要使用数据库来先存储两地之间的距离,调用的时候再来调用,那么存数据的时候,要哭的,因为光是省级区域,目前就是34个省级行政区,两个城市之间的距离,就是取任意两地之间的距离,那么按照排列组合的分析,就要有 34*33 = 1122 种排列组合方式,每个省有若干个城市,那这工作量就大了,所以需要寻找一种更为方便的方法来求两个城市之间的距离2. 先看下需求:两个城市之间的距离,在数学中,两点之间的距离…
#include <iostream> #include <cmath> #include <vector> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <algorithm> using namespace std; #define MAX_N 110 /*------------------常量区----------------…
目录 求若干个串的公共子串个数相关变形题 对一个串建后缀自动机,另一个串在上面跑同时计数 广义后缀自动机 后缀数组 其他:POJ 3415 求两个串长度至少为k的公共子串数量 @(牛客多校第四场 I题 string) 求若干个串的公共子串个数相关变形题 牛客这题题意大概是求一个长度为\(2e5\)的字符串有多少个不同子串,若\(s==t\)或\(s==rev(t)\)则认为子串\(s,t\)相同.我们知道回文串肯定和他的反串相同. 链接:传送门. 做法1: \(yx\)大佬秒出思路%%,对\(s…
目的:求多个集合之前的并集,例如:现有四个集合C1 = {11, 22, 13, 14}.C2  = {11, 32, 23, 14, 35}.C3 = {11, 22, 38}.C4 = {11, 22, 33, 14, 55, 66},则它们之间的并集应该为: C1 & C2 & C3 = {11}.C1 & C2 & C4 = {14}.C1 & C3 & C4 = {22}.如下图所示: 实现方法:Python自带了set数据类型,并且可以实现求集合…
jmeter BeanShell实例-----两个变量之间的断言对比 在jmeter的中,断言没法对两个变量的进行对比后判断,只能使用Bean Shell断言来进行,总是有人来问怎么写呢.这里写一个简单的实例吧. 需求: 获取某个用户对应的设备个数接口与数据库查询的个数结果进行对比 Bean Shell断言解决方案: 获取某个用户对应的设备个数接口这个普通的Http接口,这里就不就列出了 与Oracle数据库的查询,如下图 先建立JDBC连接配置,进行JDBC查询,然后用正则提取器 再建立Bea…
将源TXT文件sourceFile_table.txt导入数据库,生成新表dbo.sourceFile_table.新增字段lon.lat.shi.xian 源表dbo.sourceFile_table ​ ​ 源表dbo.GeographyInfo ​ ​ SQL语句: --删除表dbo.sourceFile_table中 双隐号 UPDATE sourceFile_table SET [s_id] = REPLACE([s_id],'"','') , [s_lon_lat] = REPLAC…
首先,创建两个视图控制器,在第一个视图控制器中创建一个UILabel和一个UIButton,其中UILabel是为了显示第二个视图控制器传过来的字符串,UIButton是为了push到第二个界面. 第二个界面的只有一个UITextField,是为了输入文字,当输入文字,并且返回第一个界面的时候,当第二个视图将要消失的时候,就将第二个界面上TextFiled中的文字传给第一个界面,并且显示在UILabel上. 其实核心代码就几行代码: 下面是主要代码:(因为我是用storyBoard创建的工程,所…
jmeter BeanShell实例-----两个变量之间的断言对比 在jmeter的中,断言没法对两个变量的进行对比后判断,只能使用Bean Shell断言来进行,总是有人来问怎么写呢.这里写一个简单的实例吧. 需求: 获取某个用户对应的设备个数接口与数据库查询的个数结果进行对比 Bean Shell断言解决方案: 获取某个用户对应的设备个数接口这个普通的Http接口,这里就不就列出了 与Oracle数据库的查询,如下图 先建立JDBC连接配置,进行JDBC查询,然后用正则提取器 再建立Bea…
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimming and instead rea…
Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31490   Accepted: 10150 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her,…
题目链接:http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25773   Accepted: 8374 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on an…