原文:http://blog.csdn.net/tanlijun37/article/details/1948493vector中对象指针的排序,初步想法是1: 把对象指针存到vector,重载bool operator(对象指针)2:用sort来排序例:class A{public: bool o...
分类:
编程语言 时间:
2015-03-01 16:51:51
阅读次数:
132
发现自己连向量的点乘都不会算了跨立实验#include #define MAXN 100struct point{ double x, y; point operator - (point temp) const { point res; res.x =...
分类:
其他好文 时间:
2015-03-01 06:48:41
阅读次数:
197
f(i)=min{f(j)+(D(j)using namespace std;#define N 1000001struct Point{int x,y;};bool operator =b.y;}int n,m,K,q[N];Point dp[N];int main(){ scanf("%d",&...
分类:
其他好文 时间:
2015-02-28 21:31:11
阅读次数:
166
#include#includeusing namespace std;struct S{ int a, b; string str; S operator+(const S &others) { S s1; s1.a = this->a + others.a; s1.b = this->a ...
分类:
编程语言 时间:
2015-02-28 14:28:34
阅读次数:
157
由于git的index文件出错。 需要删除.git/index文件, 然后运行git reset,重新生成index文件。 git reset还可以删除已经commit,但未push上去的信息。
分类:
其他好文 时间:
2015-02-28 11:39:36
阅读次数:
104
sublime设置:设置sublime回车跳转到()等外围:Preference-->用户热键设置-->[{"keys":["enter"],"command":"move","args":{"by":"characters","forward":true},"context":[{"key":"following_text","operator":"regex_contains","operand":"^[)\\]\\>\\‘\\\"]","ma..
分类:
其他好文 时间:
2015-02-28 00:27:01
阅读次数:
145
一、重载规则I.可以重载的操作符+-*/%^&|~!=>>>==*,->[]()operator newoperator new[]operator deleteoperator delete []II.不能重载的操作符::..*? :sizeoftypeidnewdeletestatic_cast...
分类:
编程语言 时间:
2015-02-26 14:34:23
阅读次数:
178
puts?"Please?input?Number1:?" #提示输入第一个数
number1=gets #保存第一个数
puts?"Please?input?an?operator(+,-,*,/):?"
op=gets
puts?"Please?input?Number2:?"
number2=gets
cas...
分类:
其他好文 时间:
2015-02-24 00:51:18
阅读次数:
239
10.假设写了operator new,就要同一时候写operator delete。为什么要写自己的operator new和delete,首先这不叫重载,这叫隐藏。 new仅仅是用来申请空间,而构造函数是在申请的空间的基础上继续初始化。为了效率。缺省的operator new 进行内存分配是并不...
分类:
编程语言 时间:
2015-02-23 16:36:41
阅读次数:
118
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
题意:不用乘除和mod运算计算两个数相除。
思路:因为每个数都能表示为二进制,也就是num = a*2^0 + b*2^1....,所以我们只要去判断有哪些2^k就能...
分类:
其他好文 时间:
2015-02-22 17:23:05
阅读次数:
136