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
只能作一次操作时:维护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 和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
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
深搜注意与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
表设计如图: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
代码: #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
#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