![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
知识点
canwang_sjtu
这个作者很懒,什么都没留下…
展开
-
sort 自定义
struct node{ int a; int b; double c; }; 有一个node类型的数组node arr[100],想对它进行排序:先按a值升序排列,如果a值相同,再按b值降序排列,如果b还相同,就按c降序排列。就可以写这样一个比较函数:以下是代码片段:bool cmp(node x,node y) { if(x.a!=y.a) return x.原创 2016-11-10 23:39:43 · 173 阅读 · 0 评论 -
tmux
创建 tmux new -s ipy 进入 tmux a -t ipy 关闭 tmux kill-session -t ipy 快捷键挂起 ctrl + b 加 d 快捷键退出 ctrl + b 加 & 鼠标滑动 ctrl + b 加 : 然后输入 setw -g mouse on...原创 2018-03-09 22:26:27 · 209 阅读 · 0 评论 -
string pushback +=
// length() is same as size() size_type length() const _NOEXCEPT { // return length of sequence return (this->_Mysize()); } size_type size() const _NOEXCEPT {原创 2016-11-26 22:55:41 · 539 阅读 · 0 评论 -
指针的引用和返回指针的引用
对于返回指针的引用,如果想用一个指针来引用这个function返回的引用,必须在这种情况下:int * &p = haha(q);(其中 int * &haha(int *&g)) 如果是int * p = haha(q); 那么就相当于haha为int * haha(int * &g)注意: 下面的定义是错误的: int *&p; 属于语法错误;#include<i原创 2016-11-25 23:27:06 · 556 阅读 · 0 评论 -
静态成员函数和非静态成员函数的区别
静态成员函数是没有this指针的。 非静态成员函数有一个指向当前对象的指针this; 也就是在静态成员函数里,不能访问非静态成员。原创 2016-11-23 11:23:59 · 521 阅读 · 0 评论 -
简单的位运算
想要表示一个数x的相反数,只要~x+1就可以(参考原码与补码的相互转化) 即 –x = ~x + 1某个数异或1则相当于改变它的奇偶性 比如在树中用son[0]表示左儿子,son[1]表示右儿子,当前在访问son[x],则son[x ^ 1]是另外一个儿子,原创 2016-11-18 23:14:10 · 200 阅读 · 0 评论 -
动态规划
今天无意看到一段话,深有感触,虽然与感觉这并不是最本质的理解,但是这是我现阶段的感悟/* 动态规划算法通常用于求解具有某种最优性质的问题。在这类问题中,可能会有许多可行解。每一个解都对应于一个值,我们希望找具有最优值的解。动态规划算法与分治法类似,其基本思想也是将待求解问题分解成若干个子问题,先求解子问题,然后从这些子问题的解得到原问题的解。与分治法不同的是,适合于用动态规划求解的问题,经分解得到子原创 2016-11-18 19:01:23 · 166 阅读 · 0 评论 -
二进制原码、反码、补码
特别感谢原文博主yinyhy 参考来源:http://blog.csdn.net/yinyhy/article/details/87321181.2原码原码就是符号位加上真值的绝对值, 即用第一位表示符号, 其余位表示值. 比如如果是8位二进制:[+1]原 = 0000 0001[-1]原 = 1000 0001第一位是符号位. 因为第一位是符号位, 所以8位二进制数的取值范围就是:[1111 1原创 2016-11-18 21:24:48 · 252 阅读 · 0 评论 -
k阶逆序对
#include<iostream> #include<algorithm> using namespace std;struct node { int val; int rank; bool operator<(const node &r1) const { return val < r1.val; } };node lisan[10000原创 2016-11-12 18:42:32 · 358 阅读 · 0 评论 -
文章标题
ans.add(other.arr[otherPosi].coef, other.arr[otherPosi].exp); otherPosi++; ans.add(other.arr[otherPosi].coef, other.arr[otherPosi++].exp);原创 2016-11-12 17:03:32 · 151 阅读 · 0 评论 -
json和plt画图
import json import numpy as np from collections import defaultdict from os import listdir from os.path import isfile, join from scipy import misc import matplotlib.pyplot as plt from pylab import *def原创 2018-03-03 10:18:21 · 1947 阅读 · 0 评论