定义下面两个类的成员函数(为体验友元类,实际上本例并不一定是一个好的设计,将两个类的合并为一个DateTime,日期、时间都处理更好)。
/*
* Copyright (c) 2015,烟台大学计算机学院
* All right reserved.
* 作者:邵帅
* 文件:Demo.cpp
* 完成时间:2015年04月16日
* 版本号:v1.0
*/
#include
#include
...
分类:
其他好文 时间:
2015-04-16 21:57:42
阅读次数:
146
问题描述
To simplify the building process, XadillaX built some template on the ground. The template is a very big wall and the height of each unit may be different.8Mao and Hungar have to choose any part...
分类:
其他好文 时间:
2015-04-16 21:59:28
阅读次数:
152
ansible的copy模块...
分类:
其他好文 时间:
2015-04-16 21:57:49
阅读次数:
428
D - Cyclic Nacklace
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
CC always becomes very depressed at the end of this month, he has checked his c...
分类:
其他好文 时间:
2015-04-16 21:57:27
阅读次数:
215
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3829
#include
#include
#include
#include
#include
using namespace std;
#define M 510
#define N 250010
int Head[M], Next[N], Key[N];
int match[M];
stri...
分类:
其他好文 时间:
2015-04-16 21:57:38
阅读次数:
200
整理的ZooKeeper的简要笔记...
分类:
其他好文 时间:
2015-04-16 21:56:28
阅读次数:
208
Integer a = 128;
Integer b = 128;
System.out.println(a==b);
Integer c = 1;
Integer d = 1;
System.out.println(c==d);
执行结果:false
true
...
分类:
其他好文 时间:
2015-04-16 21:58:25
阅读次数:
515
Long a = null;
System.out.println(a==-11);
Long b = null;
System.out.println(b==11);
执行结果:第一个报错,第二个不报错,但是执行会出现NullPointException。
如果Long a 不为null就不会出错了,原因是自动拆解包的时候出现了空指针,第一个的时候为检查性异常,第二个为运行时异常...
分类:
其他好文 时间:
2015-04-16 21:58:24
阅读次数:
155
问题描述:
在给定字符串中查找所有特定子串并删除,如果没有找到相应子串,则不作任何操作。要求实现函数:
int delete_sub_str(const char *str, const char *sub_str, char *result_str)...
分类:
其他好文 时间:
2015-04-16 21:56:41
阅读次数:
166
E - Period
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
For each prefix of a given string S with N characters (each character has an ASCII code ...
分类:
其他好文 时间:
2015-04-16 21:55:41
阅读次数:
112
git status命令可以列出当前目录所有还没有被git管理的文件和被git管理且被修改但还未提交(git commit)的文件.另外注意,我们可以通过git add -i 命令查看中被所有修改过或已删除文件但没有提交的文件,它有类似git status的功能...
分类:
其他好文 时间:
2015-04-16 21:55:14
阅读次数:
285
(这是一个小系列:请戳:Elasticsearch之Nested(嵌套)系列,查看其他nested相关文章)
In the same way as we need to use the special nested query to gain access to nested objects at search time, the dedicated nested...
分类:
其他好文 时间:
2015-04-16 21:57:38
阅读次数:
155
STL的设计非常巧妙,组件间互取短长,形成了一个世界,这是这个世界里的组件:
1. containers(容器):所谓容器,是指存放数据的地方,将数据以一定的方法组织存放。根据不同的组织方式,可以把容器分为顺序容器,如vector、deque、list,关联容器,如set、map。Container是一种class template。
2. algorithm(算法):各种常用不常用的算法如s...
分类:
其他好文 时间:
2015-04-16 21:55:30
阅读次数:
220
模板类function是一个通用的多态函数包装器,它的实例可以存储、拷贝并调用任何可调用对象- 函数、lambda表达式、bind表达式等其他函数对象。还可以是成员函数指针或数据成员的指针。对空的function实例调用将会抛出std::bad_function_call异常。#include
#include int main()
{
std:...
分类:
其他好文 时间:
2015-04-16 21:55:20
阅读次数:
150
Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
repeating letters ...
分类:
其他好文 时间:
2015-04-16 21:54:27
阅读次数:
126
题目大意:
有F个农场,标号为1~F。1号农场为谷仓。有C头奶牛在这些农场上,他们喜欢偷吃谷子,但是
在偷吃谷子前M秒,有个摄像头会将它们的位置记录下来。各个农场之间有P条通路,并且知道
这P条路的行走世间。如果奶牛可以在M秒之内赶到谷仓,就可以偷吃到谷子。问:有多少奶牛
可以偷吃到谷子,并升序输出它们的序号。
思路:
最短路径问题。用Dijkstra算法求出1号谷仓到各个农场的最短时间,然后看奶牛所在的农场到谷
仓的时间是否小于等于M,如果小于等于则存入结果数组ans[]中。...
分类:
其他好文 时间:
2015-04-16 21:55:44
阅读次数:
198
模拟STL中的freelist,有这个思想在内。
union obj
{
union obj* next;
char p[1];
};
class MemoryPool
{
public:
MemoryPool()
{
union obj* temp;
m_...
分类:
其他好文 时间:
2015-04-16 21:55:13
阅读次数:
170