现在位置: 首页 > shd8444发表的所有文章
网络无隐私啊 今天收到一个邮件 始终不知道别人是怎么知道我的信息的。。。
阅读全文
  • 02月
  • 15日
综合 ⁄ 共 2763字 评论关闭
Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white side up. Each round you flip 3 to 5 pieces, thus changing the color of their upper side from black to white and vice versa. The pieces to be flipped are chosen every round according to the following rules: Choose any one of the 16 pieces. Flip the chosen piece an......
阅读全文
  • 09月
  • 01日
综合 ⁄ 共 1841字 评论关闭
android中onTouchEvent和setOnTouchListener中onTouch的区别可以有些人并不了解,其实要说明白这个问题先要说下android的事件传递机制。首先看下以下的代码1,这段代码反应了View处理事件的过程: 代码1: public boolean dispatchTouchEvent(MotionEvent event) {         if (mOnTouchListener != null && mOnTouchListener.onTouch(this, event)) {             return true;         }         return onTouchEvent(event);     } 在代码1中有一点首先需要明确: 1、如果dispatchTouchEvent返回值为true则本次事......
阅读全文
共性:都是从现有的用例中抽取出公共的那部分信息,作为一个单独的用例,然后通后过不同的方法来重用这个公共的用例,以减少模型维护的工作量。 1、包含(include)       包含关系:使用包含(Inclusion)用例来封装一组跨越多个用例的相似动作(行为片断),以便多个基(Base)用例复用。基用例控制与包含用例的 关系,以及被包含用例的事件流是否会插入到基用例的事件流中。基用例可以依赖包含用例执行的结果,但是双方都不能访问对方的属性。    包含关系对典型的应用就是复用,也就是定义中说的情景。但是有时当某用例的事件......
阅读全文
题目 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使价值总和最大。 基本思路 这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。 用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包可以获得的最大价值。则其状态转移方程便是: f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]} 这个方程非常重要,基本上所有跟背包相关的问题的方程都是由它衍生出来的。所以有必要将它详细解释一下:“将前i件物品放入容量为v的背包中”这个子问题,若只......
阅读全文
今天在调试程序的过程中遇到的一个小问题,在这里记录一下,希望能对遇到同样问题的朋友有所帮助。 以下面的程序为例程进行说明: class Base { public: Base(int nNum) : m_nNum(nNum) {} private: int m_nNum; }; class A : public Base { public: A(int nNum, char bCh) : Base(nNum), m_bCh(bCh) {} private: char m_bCh; }; namespace Test { class Base { public: Base(int nNum) : m_nNum(nNum) ......
阅读全文
  • 02月
  • 21日
综合 ⁄ 共 4044字 评论关闭
图的广度优先搜索和深度优先搜索: #include <iostream> #include <queue> #include <stdio.h> #include <queue> #include <stdlib.h> #include <list> using namespace std; #define VERTEXNUM 100//最大顶点数 #define INF 65535 enum nodecolor {white,gray,black}; typedef struct node//参见算法导论322 { int adjvex;//顶点位置 struct node *next;//指向下一条边的指针 }EdgeNode; typedef struct vnode { char vertex;//顶点信息 EdgeNode *firstedge;//指向第一......
阅读全文
  • 01月
  • 26日
综合 ⁄ 共 1023字 评论关闭
在程序设计中,鸭子类型(英语:duck typing)是动态类型的一种风格。在这种风格中,一个对象有效的语义,不是由继承自特定的类或实现特定的接口,而是由当前方法和属性的集合决定。这个概念的名字来源于由James Whitcomb Riley提出的鸭子测试(见下面的“历史”章节),“鸭子测试”可以这样表述: “当看到一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么这只鸟就可以被称为鸭子。”[1][2] 在鸭子类型中,关注的不是对象的类型本身,而是它是如何使用的。例如,在不使用鸭子类型的语言中,我们可以编写一个函数,它......
阅读全文
  • 01月
  • 15日
综合 ⁄ 共 2710字 评论关闭
Digital Deletions Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description Digital deletions is a two-player game. The rule of the game is as following. Begin by writing down a string of digits (numbers) that's as long or as short as you like. The digits can be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and appear in any combinations that you like. You don't have to use them all. Here is an example: On a turn a player may either: Change any one of the dig......
阅读全文
  • 01月
  • 15日
综合 ⁄ 共 2929字 评论关闭
文章目录 Input Specification Output Specification Sample Input Sample Output Monkey and Banana Time Limit: 2 Seconds      Memory Limit: 65536 KB A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monkey is clever enough, it shall be able to reach the banana by placing one block on the top ......
阅读全文
  • 12月
  • 14日
综合 ⁄ 共 5598字 评论关闭
Mini2440 具有6 个用户测试按键,它们都是连接到CPU 的中断引脚。在/linux-2.6.32.2/drivers/char/目录下创建一个新的驱动程序文件mini2440_buttons.c #include <linux/module.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/poll.h> #include <linux/irq.h> #include <asm/irq.h> #include <linux/interrupt.h> #include <asm/uaccess.h> #include <mach/regs-gpio.h> #include &l......
阅读全文
  • 11月
  • 06日
综合 ⁄ 共 2107字 评论关闭
 //检查是否数字         function isNum(a) {             var txtValues = document.getElementById(a).value;             var b = true;             if (txtValues != "" && txtValues != null) {                 var reg = new RegExp("^[0-9]*$");                 if (reg.test(txtValues)) {                     b = true;                 }                 else {                     b = false;                     document.getElementById(a).value = "";                     document.getElementById......
阅读全文