码迷,mamicode.com
首页 >  
搜索关键字:else    ( 23991个结果
51nod 1102 面积最大的矩形 && 新疆大学OJ 1387: B.HUAWEI's billboard 【单调栈】+【拼凑段】(o(n) 或 o(nlog(n))
题面1: ? 题面2: ? 两道题除了数据范围不同,没有任何差异,两道题都可以o(n)(单调栈),o(nlog(n))(我自己的做法)解决。 解题思路1:(单调栈) 1. 对于每个点找到右边第一个比它小的位置con1,并且找到左边第一个比它小的位置con2。 2. 对于每个点更新答案为ans = m ...
分类:其他好文   时间:2018-06-16 13:40:07    阅读次数:250
java操作数据库的基本方法
此次开发工具为eclipse,才有的数据库驱动是mysql-connector-java-5.1.8-bin.jar 第一步,在eclipse的工程目录中引用mysql驱动 驱动下载地址:https://dev.mysql.com/downloads/connector/j/ 选择build pat ...
分类:数据库   时间:2018-06-16 13:34:27    阅读次数:261
5-链表
struct ListNode{ int m_nValue; ListNode* m_pNext; }; # 往该链表的末尾添加一个节点 往一个空链表中插入一个节点时,新插入的节点就是链表的头指针。由于此时会改动头指针,因此必须把pHead参数设为指向指针的指针,否则出了这个函数pHead仍然是一个... ...
分类:其他好文   时间:2018-06-16 12:07:33    阅读次数:143
C#检测本机是否联网
public class Net { [DllImport("wininet")] private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue); /// ...
分类:Windows程序   时间:2018-06-16 11:57:54    阅读次数:198
236. Lowest Common Ancestor of a Binary Tree
问题描述: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The ...
分类:其他好文   时间:2018-06-16 11:52:45    阅读次数:176
[Cracking the Coding Interview] 4.4 Check Balanced
Implement a function to check if a binary tree is balanced. For the purpose of this question, a balanced tree is defined to be a tree such that the he ...
分类:其他好文   时间:2018-06-16 10:34:06    阅读次数:169
Java 基础语法之switch语句
switch 语句由一个控制表达式和多个case标签组成。 switch 控制表达式支持的类型有byte、short、char、int、enum(Java 5)、String(Java 7)。 switch-case语句完全可以与if-else语句互转,但通常来说,switch-case语句执行效率 ...
分类:编程语言   时间:2018-06-16 10:29:18    阅读次数:123
python-条件判断
条件判断 计算机之所以能做很多自动化的任务,因为它可以自己做条件判断。 比如,输入用户年龄,根据年龄打印不同的内容,在Python程序中,用if语句实现: 根据Python的缩进规则,如果if语句判断是True,就把缩进的两行print语句执行了,否则,什么也不做。 也可以给if添加一个else语句 ...
分类:编程语言   时间:2018-06-16 10:28:34    阅读次数:122
大整数运算练习
#include #include struct bign { int d[1000]; int len; bign() { //构造函数(函数名和结构体相同, 无返回值) memset(d, 0, sizeof(d)); //头文件 len = 0; } }; bign change(char s... ...
分类:其他好文   时间:2018-06-16 00:11:14    阅读次数:156
饭卡(01背包)
电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的 ...
分类:其他好文   时间:2018-06-15 22:37:28    阅读次数:178
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!