题目大意,有两只青蛙,分别在两个石头上,青蛙A想要到青蛙B那儿去,他可以直接跳到B的石头上,也可以跳到其他石头上,再从其他石头跳到B那儿,求青蛙从A到B的所有路径中最小的Frog Distance,我们定义Frog Distance为从A到B的一条路径中最大的一条边假如点0到点1有3条路第一条路径 会经过2个点 3条边 边的值为 1 4 3第二条路径 一条边 5第三条路径 1 3 2 那么 Frog Distance 分别为 4 5 3 则最终输出3 Sample Input 20 03 4 3…
Sample Input 1 // T3 3// n m1 2 3//u v w1 3 42 3 5Sample Output Scenario #1:4 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # define LL long long using namespace std ; ; c…
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…
#include <stdio.h> int main(void) { /* 选择排序算法 原理:从数组中 找出最小的元素然后交换位置: */ int a[10] = {9,5,10,7,2,3,1,6,8,4}; int i=0,j=0; int n = sizeof(a)/4; //外循环n-1轮 for(i=0;i<n-1;i++){ int pos = i;//始终指向最小的位置 for(j=i+1;j<n;j++){ if(a[j]<a[pos]){ pos = j…
package bianchengti; /* * 在由N个元素构成的集合S中,找出最小元素C,满足C=A-B, * 其中A,B是都集合S中的元素,没找到则返回-1 */ public class findMinValue { //快速排序 public static void sort(int a[], int low, int hight) { if (low > hight) { return; } int i, j, key; i = low; j = hight; key = a[i]…
Frogger Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2253 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…
在一个SQL Server表中一行的多个列找出最大值 有时候我们需要从多个相同的列里(这些列的数据类型相同)找出最大的那个值,并显示 这里给出一个例子 IF (OBJECT_ID('tempdb..##TestTable') IS NOT NULL) DROP TABLE ##TestTable CREATE TABLE ##TestTable ( ID ,) PRIMARY KEY, Name ), UpdateByApp1Date DATETIME, UpdateByApp2Date DAT…
当做到某些功能的时候,使用Set能够快速方便地将需要的类型以集合类型保存在一个变量中,Set是最简单的一种集合,集合中的对象不按特定的方式排序,并且没有重复对象. //两个Set比较找出交集.差集.并集 public static void setCompare() { Set<Integer> result = new HashSet<Integer>(); Set<Integer> set1 = new HashSet<Integer>() {{ add…
做到了这个题,感觉网上的博客是真的水,只有kuangbin大神一句话就点醒了我,所以我写这篇博客是为了让最短路的入门者尽快脱坑...... 本题思路:本题是最短路的变形,要求出最短路中的最大跳跃距离,基本思路与最短路一样,dist数组为当前点到源结点最短路的最大距离,这样的话我们知道只需要改变松弛方程就可以了,每次我们选取一个最小值dist[ k ],那么接下来我们就需要将与结点k相邻的结点都更新,如何更新呢,当然是选取之前所走路中的最大值和现在需要走的路中的值的最大值啦即dist[ j ] =…
//数组中排序    int in[] = {1,6,5,8,9};    Arrays.sort(in);    for(int i=0;i<in.length;i++){       System.out.println(in[i]);   }    //数组中取最大值,最小值    int arr[] = {6,3,8,5,7,4,1};          int min2 = arr[0];          int temp = 0;          for(int i=1;i<a…