1003 Emergency (25分) #include<stdio.h> #include<iostream> using namespace std; const int maxn=1010; const int INF=1000000000; int n,m,c1,c2; int G[max ...
分类:
其他好文 时间:
2020-09-17 23:33:09
阅读次数:
34
/** *@param 参数一:查找的数组 参数二:要找的值 * */ public static int dichotomia(int[] arry,int key) { int min = 0; int max = arry.length() - 1; int mid = (min + max) ...
分类:
其他好文 时间:
2020-09-15 21:24:27
阅读次数:
45
给定一个字符串 s,找到 s 中最长的回文子串。 public static String longestPalindrome(String s) { //最大长度 int max=0; //最大长度的回文中心 int mi=0; //加#避免漏虚轴 char[] chars = addf(s); ...
分类:
其他好文 时间:
2020-09-14 19:04:06
阅读次数:
39
输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数。比如输入 3,则打印出 1、2、3 一直到最大的 3 位数 999。 示例 : 输入: n = 1 输出: [1,2,3,4,5,6,7,8,9] 1 public int[] printNumbers(int n) { 2 int max ...
分类:
其他好文 时间:
2020-08-17 17:42:17
阅读次数:
53
#include<iostream> #include<vector> using namespace std; #define MAX 10005 #define REP(i,b,e) for(int i=b;i<e;i++) vector<int>b[MAX]; int a[MAX], p[MA ...
分类:
移动开发 时间:
2020-08-06 22:04:18
阅读次数:
115
求出数组中的 "最" 值 int [ ] array = new {19,395,64,7,47,26,72,26,37,73,252,624,62,652,242,}; int max = array [ 0 ]; for ( int i = 1; i < array.length; i ++){ ...
分类:
其他好文 时间:
2020-07-30 10:43:53
阅读次数:
71
/* a是一个3*4的整型数组。函数max_value求最大值max,请编写max_value函数和 main()函数,在main()函数中调用max_value函数求出3*4的整型数组的最大值并输出结果 */ #include <stdio.h> int max_value(int a[][4], ...
分类:
编程语言 时间:
2020-07-28 14:10:10
阅读次数:
68
1.流 得到流 Stream<T>stream = collection.stream(); 对于数组 : Arrays.sstream(ary) 对于collection : 用list.stream() import java.util.*;class streamList { public s ...
分类:
编程语言 时间:
2020-07-27 23:35:53
阅读次数:
73
思路: 1.使用DFS遍历整颗树 2.二叉树的根节点的范围为INT_MIN,INT_MAX. 3.对于当前节点判断是否合法,合法条件:先遍历左子树的最大值是否小于当前节点的值,在遍历右子树,右子树的最小值是否大于当前节点的值 注意: 根节点的边界为 INT_MIN,INT_MAX 左子树的范围:lo ...
分类:
其他好文 时间:
2020-07-27 13:53:58
阅读次数:
61
类型:有关素数的基础算法 思路:埃氏筛选 AC代码: #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int MAX_N=10000000; int prime[MAX_N]; b ...
分类:
其他好文 时间:
2020-07-26 01:30:40
阅读次数:
73