Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.这道题,第一次刷是过了,第二次同样的代码超时了,看来case是在不断...
分类:
其他好文 时间:
2014-07-22 22:50:32
阅读次数:
237
基础 树状数组
每输入一组数,就对染色次数进行修改;
#include
#include
#include
using namespace std;
int s[100005],a;
int low(int i)
{
return i&(-i);
}
void show(int q,int w)
{
while(q>0)
{
s[q]+=w;...
分类:
其他好文 时间:
2014-07-22 22:49:35
阅读次数:
188
感言:以后中国高中生的专场还是慎入!!!!
A题目还是比较简单
AC代码:
#include
#include
using namespace std;
struct p
{
int number;
int val;
}num[105];
bool cmp(p x,p y)
{
if(x.val==y.val)
return x.number>...
分类:
其他好文 时间:
2014-07-22 22:49:34
阅读次数:
186
public static String lcs(String a, String b){ int aLen = a.length(); int bLen = b.length(); if(aLen==0 || bLen==0) return ""; if(a.char...
分类:
其他好文 时间:
2014-07-22 22:49:15
阅读次数:
194
直接上代码 struct People{
int age;
}
int main(){
struct People * p= malloc(sizeof(struct Perople));
p->age=10;
struct People * p1=p;
p-age=12;
printf("%d\n",p1->age);
free(p);
return 0;
}
} 函...
分类:
编程语言 时间:
2014-07-21 10:22:57
阅读次数:
222
在C++中所特有的另一种内置类型bool。它只是一种特殊情况,因为对于布尔值,我们并不需要像++这样的操作符。反之,我们需要特定的布尔操作符,例如&=和|=,因此,这个类型是单独定义的:
class Bool
{
public:
Bool(bool x=false)
: data_(x)
{
}
operator bool () const
{
return data_;
}...
分类:
其他好文 时间:
2014-07-20 10:47:16
阅读次数:
192
函数引用操作符
struct absInt
{
int operator()(int val) const
{
cout!!!"<<endl;
return val<0 ? -val : val;
}
};
void fun1()
{
int i=-42;
absInt absObj;
int ui=absObj...
分类:
编程语言 时间:
2014-07-20 10:32:09
阅读次数:
380
在python的官方文档中:getattr()的解释如下:getattr(object,name[,default])Return the value of the named attribute ofobject.namemust be a string. If the string is the...
分类:
编程语言 时间:
2014-07-20 09:01:37
阅读次数:
228
/** \brief hdu 1009--greedy
*
* \param date 2014/7/18
* \param state AC
* \return
*
*/
#include
#include
#include
#include
using namespace std;
const int MAXN=1001;
struct Data
{
int...
分类:
其他好文 时间:
2014-07-19 23:41:49
阅读次数:
237
int gcd(int n,int m)//n>m
{
//最大公约数
int r;
while(m)
{
r = n%m;
n = m;
m = r;
}
return n;
}
int kgcd(int a,int b)
{
if(!a) return b;
if(!b) retu...
分类:
其他好文 时间:
2014-07-19 23:37:19
阅读次数:
309