码迷,mamicode.com
首页 >  
搜索关键字:int-max    ( 1549个结果
最小堆
int a[Max],n; void build(int t) { int Min=a[t]; int l=2*t,k=t; int r=2*t+1; if(r<=n&&a[r]<Min) { Min=a[r]; k=r; } if(l<=n&&a[l]<Min) { Min=a[l]... ...
分类:其他好文   时间:2018-06-01 17:39:16    阅读次数:149
一元、二元、三元逻辑运算符
一元运算符Java的一元运算符有++(自加)、--(自减) 二元运算符Java的二元运算符有+(加)、-(减)、*(乘)、/(除)、%(取余数)。三元运算符true?value1:value2;例: int a=0x10 , b=010 , max ;max=a>b ? a : b ; ...
分类:其他好文   时间:2018-05-31 00:33:15    阅读次数:216
410. Split Array Largest Sum
class Solution { public: int splitArray(vector& nums, int m) { int _max = -1, _sum = 0; for (auto n : nums) { if (n > _max) _max = n; _sum += n; ... ...
分类:其他好文   时间:2018-05-27 16:25:23    阅读次数:146
简单排序和输出
class ArrayTool{ //最大值 public static int getMax(int[] arr) { int max=0; for (int x=0;x<arr.length ;x++ ) { if (arr[x]>arr[max]) { max =x; } } return a ...
分类:编程语言   时间:2018-05-26 15:30:49    阅读次数:154
矩阵快速幂
#include using namespace std; #define Max 3 #define mod 10000 int m; //m阶矩阵 struct Matrix { int m[Max][Max]; }; Matrix Mul(Matrix a,Matrix b) { Matrix... ...
分类:其他好文   时间:2018-05-23 22:10:23    阅读次数:113
LeetCode - Binary Tree Longest Consecutive Sequence
Recursion: 时间O(n) 空间O(h) 因为要找最长的连续路径,我们在遍历树的时候需要两个信息,一是目前连起来的路径有多长,二是目前路径的上一个节点的值。我们通过递归把这些信息代入,然后通过返回值返回一个最大的就行了。 ...
分类:其他好文   时间:2018-05-23 11:57:56    阅读次数:163
209. Minimum Size Subarray Sum
class Solution { public: int minSubArrayLen(int s, vector& nums) { int w = 0, _sum = 0, res = INT_MAX; for (int i = 0; i = s) { res = min(res, i-w+1);... ...
分类:其他好文   时间:2018-05-21 14:28:29    阅读次数:138
[java,2017-05-17] 数据型参数趣谈
int的最大值是多少?加一呢?乘2呢? 第一个问题我想大多数人都知道,不知道后两个有多少人研究过。 首先上一段代码: 运行结果 int int_max 2147483647int_max+1 2147483648int_min 2147483648int_min-1 2147483647int_ma ...
分类:编程语言   时间:2018-05-17 13:30:53    阅读次数:153
两非负整数求最大公约数(欧几里德算法)---C/C++
#include using namespace std; //欧几里德算法求两个非负整数的最大公约数 int getDivisor(int a,int b) { int max,min; max = a; min = b; //两数中大数模小数,若结果不为0,则舍弃大数 ,把小数和模运算的结果分出... ...
分类:编程语言   时间:2018-05-10 23:42:27    阅读次数:163
DAG动态规划-硬币问题
``` include using namespace std; int n, m, t; const int INF = 0x3f3f3f3f; int a[1005],Max[1005],Min[1005]; void dfs(int d, int s) { for(int i=1; i=a[i ...
分类:其他好文   时间:2018-05-08 22:20:39    阅读次数:161
1549条   上一页 1 ... 33 34 35 36 37 ... 155 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!