题目:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.代码:class Solution {public: int div...
分类:
其他好文 时间:
2015-06-09 16:31:20
阅读次数:
97
My first try was DFS by intuition, but it ended up with MLE. So, the expected solution is to use stack:class Solution { struct Node { Nod...
分类:
其他好文 时间:
2015-06-09 15:25:31
阅读次数:
115
Python作为一种脚本语言,其非常适合文件级的各种操作。下面的代码可以批量删除指定文件夹下的全部特定类型(CSV类型)的文件。
import sys, csv , operator
import os
import glob
for i in range(0, 20):
path = "C:\\Python34\\Folder_" + str(i)
for infile in glo...
分类:
编程语言 时间:
2015-06-09 13:52:29
阅读次数:
123
G -Dice (III)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %lluDescriptionGiven a dice withnsides, you have to find the expected number ...
分类:
其他好文 时间:
2015-06-09 09:43:13
阅读次数:
103
一、等价与相等的简述 在容器中,等价并不是相等。为什么要提等价与相等呢?因为泛型算法中的find等用于比较的是相等,即以operator==为基础,而容器成员函数的比较是以operator 2 3 struct CIStringCompare{ 4 bool operator()(con...
分类:
其他好文 时间:
2015-06-09 00:41:29
阅读次数:
134
用C++编写Int函数来实现基本运算如下:
#include
using namespace std;
class Int
{
public:
Int(int i=0):m_i(i)
{}
~Int()
{}
Int& operator++() //前置++
{
m_i++;
return *this;
}
In...
分类:
编程语言 时间:
2015-06-08 10:01:38
阅读次数:
136
String 类的原型如下class String{ public: String(const char *str=NULL);//构造函数 String(const String &other); //拷贝构造函数 ~String(void); //析构函数 String& operator=(c...
分类:
其他好文 时间:
2015-06-08 00:55:26
阅读次数:
199
模块化设计:
头文件:
#ifndef operator_operator_h
#define operator_operator_h
#include
#include
using namespace std;
class MyString
{
public:
//三个重载的构造函数
MyString();
MyString(const c...
分类:
编程语言 时间:
2015-06-07 14:35:41
阅读次数:
304
单机版使用的是FileSystem类的静态函数:FileSystem hdfs = FileSystem.get(conf) 伪分布式下需要使用Path来获得Path path = new Path("hdfs://mlj:9000/dir"); FileSystem hdfs = path.ge....
分类:
其他好文 时间:
2015-06-07 14:34:23
阅读次数:
338
重载操作符
重载操作符是一些函数, 其名字为operator后跟着其所定义的操作符符号. 如operator =, operator +, operator * 等等.
操作符函数和普通函数一样, 也是 返回值 + 函数名 + (形参表) , 形参表必须具有与该操作符操作数数目相同的形参(如果操作符是一个成员, 则包括隐式this形参).
赋值操作符
...
分类:
编程语言 时间:
2015-06-07 09:48:44
阅读次数:
210