码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
【快速幂】 模板
int quick_pow(int a, int n){ int ans = 1; while (n) { if (n & 1) { ans = (long long )ans * a % inf; } n >>= 1...
分类:其他好文   时间:2014-10-10 00:35:11    阅读次数:218
局部变量地址的返回
char *fun() { char str[] = "hello"; return str; } 这个函数的返回值?以及这个函数在栈上的存储布局 #include #include #include char *fun() { char ptr[] = "fda"; int a = 3; int b = 4; ...
分类:其他好文   时间:2014-10-10 00:18:58    阅读次数:313
Best Time to Buy and Sell Stock I,II,III [leetcode]
Best Time to Buy and Sell Stock I 只能作一次操作时:维护preMin记录之前出现的最小值 代码如下: int maxProfit(vector &prices) { if (prices.size() == 0) return 0; int profit = 0; int preMin = prices...
分类:其他好文   时间:2014-10-10 00:02:08    阅读次数:204
java 之 引用
一:java 和c++引用的对比 提到引用,我们都会想到java里面没有像c++里面的指针,当然java里面的引用和c++里面的引用是不同的。 例如: 比如C++中,我对某一个函数的声明,int a(int &b),b即为引用类型,函数内b的修改可以影响到函数外部; C++中,int a(int &b){},b即为引用类型,若没有&,b即为值类型;但是在java里面没有显示的符号说明是引用...
分类:编程语言   时间:2014-10-10 00:01:18    阅读次数:328
【RMQ】 区间最值查询详解
1.概述RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,jO(nlogn){for(int j = 1; j #include #include using namespace std;c...
分类:其他好文   时间:2014-10-09 23:36:27    阅读次数:627
【字母全排列】 poj 1256
深搜注意与STL模版的去重函数唯一的区别就是有去重。#include #include #include #include using namespace std;int len;char ch[15],ss[15];int visted[15];bool cmp(char a,char b){ ....
分类:其他好文   时间:2014-10-09 23:18:27    阅读次数:202
ASP.NET递归添加树节点
表设计如图:id title parentid1 asp.net 02 c# 03 c#_0 24 c#_1 35 c#_2 4页面中添加一个TreeView控件写添加节点方法: private void AddNode(int id, TreeNode parentnode) { string ....
分类:Web程序   时间:2014-10-09 22:45:47    阅读次数:221
sizeof与数组长度
代码: #include?<stdio.h> #include?<stdlib.h> #define?LENGTH?10 void?func(int?arr[]); int?main(void)?{ int?arr[LENGTH]?=?{?0?}; //?sizeof?数组名:整个数组大小 //?sizeof?数组...
分类:其他好文   时间:2014-10-09 22:44:08    阅读次数:223
字典树模板!
1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 struct tree 8 { 9 int count;10 tree *next[26];11 };12 tree *head;13 14 voi...
分类:其他好文   时间:2014-10-09 22:30:07    阅读次数:224
HDU 4344 随机法判素数(费马小定理
#include #include #include #include using namespace std; typedef long long ll; const int N = 108; const int S = 10; ll mult_mod(ll a, ll b, ll c) { a %= c; b %= c; ll ret = 0; whi...
分类:其他好文   时间:2014-10-09 22:24:38    阅读次数:234
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!