- 博客(11)
- 资源 (4)
- 收藏
- 关注
原创 Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "
2014-02-26 09:30:28 818
原创 c语言细读之static auto
static的作用:1. 修饰函数, 静态函数, 只在本文件中有用, 作用:~只自己使用, 保护代码。~避免重名2. 修饰局部变量~ 存储在静态区~ 编译时就赋值, 且只一次, 若未赋值, 则赋0~ 生存期直到程序结束3. 修饰全局变量~ 作用域从定义处到文件结束~ 不可在其它文件中extern, 可在本文件定义前extern
2014-02-24 09:53:19 1070
原创 dpkg:error错误求解:——重复文件触发关注
此问题困扰本人月余, 原因至今未明. 然觅得一法可解决到目录/var/lib/dpkg中, 删除trigger文件夹此时再apt-get updateapt-get upgrade 这时将重新安装以前所有的更新 如果不这样, 当安装其它程序时,总是提示上述错误, 无法更新和使用apt-get -f install 原因不明, 此方法后果亦未知, 慎用
2014-02-19 23:38:10 2774 3
原创 memcpy实现
memcpy/* * ===================================================================================== * * Filename: memcp.c * * Description: * * Version: 1.0 * Created:
2014-02-19 14:49:01 846
原创 Palindrome Number
很2的一个解法, 好多情况没考虑, 只考虑正数了class Solution {public: bool isPalindrome(int x) { if(x<0)return false; int numbers = x; //位数 int digit = 0; int times = 10;
2014-02-18 21:16:27 1151
原创 no matching function for call to 'sort(...),
初leetcode的two sum 题中排序坑死, 枉费好长时间no matching function for call to 'sort(std::vector::iteratorsort(,,.,,., cmp);当时确信代码正确, 类型更是比对好久, 总是提示这个错误.后来才发现, cmp函数要定义在类的外面, 具体:cmp(){...}clas
2014-02-18 10:52:36 8415
原创 leetcode:Two Sum
struct Node { int val; int index; Node(){} Node(int x,int y):val(x),index(y){} }; bool compare(const Node &aa, const Node &bb) { return aa.val<bb.v
2014-02-18 10:47:09 869
原创 Read Phone Number
/* * ===================================================================================== * * Filename: readphonenumber.c * * Description: * * Version: 1.0 * Create
2014-02-16 12:39:04 1049
原创 blackmagic Capture.cpp
#include #include #include #include #include #include #include "DeckLinkAPI.h"#include "Capture.h"pthread_mutex_t sleepMutex;pthread_cond_t sleepCond;int videoOutputFile = -
2014-02-13 11:45:41 1912
原创 n皇后问题
原理很简单#include using namespace std;int x[20]; //解向量int sum; //可行方案个数int n;//在第t列是否可放置bool place(int t){ int i; for(i=1; i<t; i++) //如果 行-行 == 列-列 或者 在同一列。 if(abs(t-i) == abs(x[t]-x[i])
2014-02-12 17:32:00 931
原创 随机投点法计算圆周率
#include #include #include using namespace std;// 获得0-1之间的随机数double get_random_num (){ return (double)rand () / RAND_MAX ;}// 用随机投点法计算 PIdouble darts (int n){ int k = 0 ; for (i
2014-02-12 15:29:04 11040 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人