无聊,刷水题练下java
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner cin=new Scanner(System.in);
double n;
int m;
while(cin.hasNext())
{
n=cin.nextDouble...
分类:
其他好文 时间:
2015-05-07 16:56:24
阅读次数:
130
题意:给你十个俄罗斯方块,问你能否拼成指定长宽的矩形,方块下落的顺序是严格确定的,后下落的方块不能落在先下落的方块之下。
每个俄罗斯方块都是由更小的小方格拼成的,
可以用一个一维数组来记录每一列已经摞上了多少个小方格。DFS遵循底部放满原则,如果可以恰好和已存在的方块实现无缝拼接才往上放,否则回溯。
#include
#include
using namespac...
分类:
其他好文 时间:
2015-05-07 16:55:45
阅读次数:
116
攻击介绍:
类似于Smurf,使用UDP应答消息而非ICMP。UDP端口7(ECHO)和端口19(Chargen)在收到UDP报文后,都会产生回应。在UDP的7号端口收到报文后,会回应收到的内容,而UDP的19号端口在收到报文后,会产生一串字符流。它们都同ICMP一样,会产生大量无用的应答报文,占满网路带宽。攻击者可以向子网广播地址发送源地址为受害网络或受害主机的UDP包,端口号用7或19.子网络...
分类:
其他好文 时间:
2015-05-07 16:55:03
阅读次数:
158
Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, re...
分类:
其他好文 时间:
2015-05-07 16:54:03
阅读次数:
106
1.1.1.1
闪回归档
前面闪回都是基于undo来实现的闪回,由于我们的闪回都是不确定时间的,所以就会导致ORA-01555(快照太旧或者被覆盖)、ORA-01466(表定义被改)、ORA-08180(没有快照)等错误。
1.1.1.1.1
创建表空间,默认大小500M
SQL> CREATE TABLESPACEhis_data_1 data...
分类:
其他好文 时间:
2015-05-07 16:54:46
阅读次数:
213
垒骰子
赌圣atm晚年迷恋上了垒骰子,就是把骰子一个垒在另一个上边,不能歪歪扭扭,要垒成方柱体。
经过长期观察,atm 发现了稳定骰子的奥秘:有些数字的面贴着会互相排斥!
我们先来规范一下骰子:1 的对面是 4,2 的对面是 5,3 的对面是 6。
假设有 m 组互斥现象,每组中的那两个数字的面紧贴在一起,骰子就不能稳定的垒起来。 atm想计算一下有多少种不同的可能的垒骰子方式。
两...
分类:
其他好文 时间:
2015-05-07 16:51:59
阅读次数:
169
题目
思路
明显的拓扑排序。
这里用的C写,用malloc动态分配内存给二维数组挺烦的,当做锻炼吧。代码bool canFinish(int numCourses, int** prerequisites, int prerequisitesRowSize, int prerequisitesColSize) {
int * Indegrees;
bool ** IsConne...
分类:
其他好文 时间:
2015-05-07 16:51:44
阅读次数:
132
Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
解题思...
分类:
其他好文 时间:
2015-05-07 16:50:12
阅读次数:
90
要把项目在服务器间迁移的童鞋, 这都是必不可少的技能......
分类:
其他好文 时间:
2015-05-07 16:52:13
阅读次数:
106
让我们来尝试一次深度匹配,在我们的模式匹配中检查对象的内容。
//code-examples/Rounding/match-deep-script.scala
case class Person(name: String, age:Int)
val alice = new Person("Alice",25)
val bob = new Person("Bob",32)
...
分类:
其他好文 时间:
2015-05-07 16:52:34
阅读次数:
97
Yaroslav has an array, consisting of (2·n?-?1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exac...
分类:
其他好文 时间:
2015-05-07 16:49:51
阅读次数:
132
GNU C 的一大特色就是__attribute__ 机制。__attribute__ 可以设置函数属性(Function Attribute )、变量属性(Variable Attribute )和类型属性(Type Attribute )。
__attribute__ 书写特征是:__attribute__ 前后都有两个下划线,并切后面会紧跟一对原括弧,括弧里面是相应的__attribute__ 参数。
__attribute__ 语法格式为:__attribute__ ((attribute-li...
分类:
其他好文 时间:
2015-05-07 16:51:41
阅读次数:
196
Redis主从拷贝的特点
1. 同一个Master可以拥有多个Slaves。
2. Master下的Slave还可以接受同一架构中其它slave的链接与同步请求,实现数据的级联复制,即Master->Slave->Slave模式;
3. Master以非阻塞的方式同步数据至slave,这将意味着Master会继续处理一个或多个slave的读写请求;...
分类:
其他好文 时间:
2015-05-07 16:51:41
阅读次数:
112
[图像处理]_对数变换 算法实现
对数变换可实现图像的水平平移、竖直平移、对称变换等操作
也可实现图像灰度的扩展和压缩功能。
实现代码如下:
int LogTranslation(Mat srcImg, Mat dstImg, float a, float b, float c)
{
Mat logTable(1,256,CV_8U);
double temp;
for ( in...
分类:
其他好文 时间:
2015-05-07 16:49:58
阅读次数:
263
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a ...
分类:
其他好文 时间:
2015-05-07 16:48:34
阅读次数:
78
题目描述Reverse a singly linked list.例如: 1 -> 2 -> 3 -> 4 -> 5 -> 6 ==> 6 -> 5 -> 4 -> 3 -> 2 -> 1本题比较简单,使用两个指针,一个指针(p)表示前一个结点,另一个(l)表示当前结点。主要指针操作如下:ListNode* t = l -> next; // next of current node
l -> n...
分类:
其他好文 时间:
2015-05-07 16:50:05
阅读次数:
84
1:为什么要用Protocol Buffer?
在回答这个问题之前,我们还是先给出一个在实际开发中经常会遇到的系统场景。比如:我们的客户端程序是使用Java开发的,可能运行自不同的平台,如:Linux、Windows或者是Android,而我们的服务器程序通常是基于Linux平台并使用C++开发完成的。在这两种程序之间进行数据通讯时存在多种方式用于设计消息格式,如:
1. 直...
分类:
其他好文 时间:
2015-05-07 16:50:45
阅读次数:
451