码迷,mamicode.com
首页 >  
搜索关键字:int-max    ( 1549个结果
Leetcode1372 最长交错路径,记忆化递归
借助全局变量 max 存储全局最优解,遍历以所有节点为头结点的子树。 static final int LEFT = -1; static final int RIGHT = 1; int max = 0; public final int longestZigZag(TreeNode root) ...
分类:其他好文   时间:2020-06-28 22:15:48    阅读次数:67
三目运算符学习
/*1.三目运算符的使用 2.日期:2020年6月25日12:04:48 3.环境:vs2019*/ #include<stdio.h> int main() { //定义变量 int a = 0; int b = 0; int c = 0; int max = 0; scanf_s("%d%d%d ...
分类:其他好文   时间:2020-06-25 16:03:17    阅读次数:55
P1873 砍树
https://www.luogu.com.cn/problem/P1873 #include<bits/stdc++.h> using namespace std; int n, m, a[1000005], max_h=-1; bool check(int h){ long long sum=0 ...
分类:其他好文   时间:2020-06-24 21:58:12    阅读次数:53
leetcode——124. 二叉树中的最大路径和
动态规划好巧妙啊啊啊啊啊啊啊 啊 int max =Integer.MIN_VALUE; public int maxPathSum(TreeNode root) { //用动态规划来求解 //DFS //根节点的值、左子树的值、右子树的值、 dfs(root); return max; } pri ...
分类:其他好文   时间:2020-06-24 21:45:36    阅读次数:59
最值问题
1.顺序表的最值 int maxnum(int a[],int n){ int ma=a[0]; int max_p=0; for(int i=0;i<n;i++){ if(a[i] > ma){ ma=a[i]; max_p=i; } } return max; } int minnum(int ...
分类:其他好文   时间:2020-06-21 17:46:47    阅读次数:37
怎么求动态数组中的最大值和最小值
@Test //写出四家店的最低价和最高价 public void test02(){ int []mon =new int [4]; //定义数组的长度 int max =0; //定义一个最大值 int min =0; //定义一个最小值 // 先进行一次循环统计出数组中各项的值 for (in ...
分类:编程语言   时间:2020-06-18 21:49:00    阅读次数:94
pta 7-9 旅游规划 floyd
题目::https://pintia.cn/problem-sets/15/problems/717 #include<iostream> using namespace std; const int N = 505 ; const int MAX = 1000000000 ; int n,m,s, ...
分类:其他好文   时间:2020-06-15 00:04:00    阅读次数:76
CodeForces 1363F. Rotating Substrings
题意:你被给予了两个字符串s和t,每个字符串的长度都是n并且是小写字母,你的目标是让s变成t。 你可以进行如下的操作多次,使得字符串s变成字符串t,选择字符串s的子串并使得它旋转,即让$s[l, l + 1...r]$变成字符串$s[r, l, l + 1...r - 1]$,其它字符保持原有的位置 ...
分类:其他好文   时间:2020-06-03 15:40:36    阅读次数:64
[LeetCode] 101. 对称二叉树
这个题真的是lc送给我们的儿童节礼物,简单的甜哈 class Solution { public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) { int max=candies[0]; for(int i=1;i<ca ...
分类:其他好文   时间:2020-06-01 23:56:33    阅读次数:94
七大排序之归并排序
1 #include<iostream> 2 #include<time.h> 3 #include<stdlib.h> 4 #include<sys/timeb.h> 5 using namespace std; 6 7 const int Max = 9999; 8 9 void swap(in ...
分类:编程语言   时间:2020-06-01 20:36:38    阅读次数:63
1549条   上一页 1 ... 3 4 5 6 7 ... 155 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!