- 博客(18)
- 资源 (2)
- 收藏
- 关注
原创 控件的调用和设置
<br />一、基础知识。<br /> 1、控件的Id保存在R类下的id类中。在需要使用控件的地方通过fineviewbyid(R.id.控件的id名字)来实例化一个控件。<br /> 如在界面中有一个textview的Id设置为<br /> android:id=“@+id/txtName”;<br /> 则在R类下的id类中会有一个txtName的属性。<br /> 在需要使用这个控件时,须先实例化。<br /> TextView txt
2011-05-11 19:36:00
496
原创 子网掩码
<br />1、子网掩码的作用:<br /> 用来指明IP地址那些是网络号,那些事主机号,用来表示两个IP地址是否属于同一个子网。<br /> 它也是一组32位长的二进制数值,其每一位上的数值代表不同含义:为“1”则代表该位是网络位;若为“0”则代表该位是主机位<br />2.现在存在的问题:网络号占位太多,而主机号位太少。<br />3.解决方法:目前最常用的一种解决办法是对一个较高类别的IP地址进行细划,划分成多个子网,然后再将不同的子网提供给不同规模大小的用户群使用<br />4.子网掩码计算<br
2011-05-03 17:39:00
561
原创 I/O多路复用
<br />一、五种I/O模型<br />1、阻塞I/O模型<br /> 最流行的I/O模型是阻塞I/O模型,缺省情形下,所有套接口都是阻塞的。我们以数据报套接口为例来讲解此模型(我们使用UDP而不是TCP作为例子的原因在于就UDP而言,数据准备好读取的概念比较简单:要么整个数据报已经收到,要么还没有。然而对于TCP来说,诸如套接口低潮标记等额外变量开始活动,导致这个概念变得复杂)。<br /> 进程调用recvfrom,其系统调用直到数据报到达且被拷贝到应用进程的缓冲区中或者发生错误才返回
2011-05-03 16:12:00
1901
原创 最小生成树 kruskal
<br />#include"iostream"using namespace std;int n,a[101][101],m,x,y,b[101],e[101][101],x1,y1,sun,c[101][101];int see(){ int min1=1000000; int i,j; for(i=2;i<=n;i++) { for(j=1;j<i;j++) { if(e[i]
2010-09-07 11:58:00
334
原创 最小生成树 prim
<br />#include"iostream"using namespace std;int a[101][101],f[101],n,m,x,y,x1,y1 ;int see(){ int i,j; int min1=1000000; for(i=1;i<=n;i++) { if(f[i]==1) for(j=1;j<=n;j++) { if(f[j]==0&&a[i][j]<min1) { min1=a[i][j]
2010-09-07 11:56:00
346
原创 杭电 1072 Nightmare
Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of the bomb is set to
2010-08-22 16:34:00
549
原创 杭电 1081 To The Max
Problem DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater located within the whole array. The sum of a rectangle is the sum of all the elements in that rectangle
2010-08-17 16:30:00
621
原创 杭电 1075 What Are You Talking About
Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into En
2010-08-17 15:55:00
1793
1
原创 航点1069 Monkey and Banana
Problem DescripionA 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
2010-08-16 20:47:00
468
原创 黑白点
方阵中有黑白点,黑点以.表示,白点以#表示。一个人从黑点开始,记为@;只能从一个黑点到另一个黑点,问他最多能踩几个黑点。分析:可采用回溯法, 源代码如下: #include"iostream"#include"string"using namespace std;char a[30][30];int b[30][30],m,n,x1,y1;int g[4][2]={{1,0},{-1,0},{0,1},{0,-1}};int ff(int x,int y){ if(a[x]
2010-08-13 21:53:00
763
原创 杭电 acm 1045
Problem DescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings through which to
2010-08-04 11:29:00
1566
原创 杭电 1016
<br /><br /> Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.<br /><br />Note: the number of first circle s
2010-08-01 19:05:00
1940
原创 杭电acm 1010
Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap, and he tried desperately
2010-08-01 11:38:00
2230
原创 最短路径问题
<br />[问题描述]<br /><br />已知有向图有12个顶点,21条边,起点为S,终点为E,求从S到E的最小成本花费W。(如图)<br /><br />起点 终点 花费 起点 终点 花费 起点 终点 花费<br />1 2 9 4 8 11 9 12 4<br />1 3
2010-06-26 20:22:00
383
原创 回溯法的实现
<br />【递归实现】<br /> void backtrack (int t)<br />{<br />if (t>n) output(x);<br />else<br />for(int i=f(n,t):i<=g(n,t):i++)//f(n,t),g(n,t)表示当前扩展节点处未搜索过的子树的起始编号和终止编号<br />{<br />x[t]=h[t];//h(i)为当前扩展节点处x[t]的第i个可选值<br />if(constraint(t)&&bound(t)) backtrack(t
2010-06-26 19:35:00
386
原创 旅行售货员问题
<br />【问题描述】 <br />某售货员要到N个城市去推销商品,已知各城市之间的路程(或旅费)。他从S出发,经过每个城市一次,最后回到S,城市之间的路径是双向的,使总的路程最小。(为简化问题,假设题中S=1出发)<br />【问题分析】<br />1。经过每个城市一次,且经过所有城市<br /> 可设一个标志经过了城市则x[i]=1,否则x[i]=0;<br />2.用二维数组来表示两个城市这几的路程x[i][j]=weight;<br /> 这样标记可改为x[i][i]<br />【算法设计
2010-06-26 19:19:00
784
原创 作业调度
<br />#include"iostream"#include"fstream"using namespace std;typedef struct job{ int num; int time;}job;int sort(job *job1,int n){ int i,j;job max; for(i=1;i<=n;i++) for(j=i+1;j<=n;j++) { if(job1[i].time<job1[j].time)
2010-06-25 00:25:00
412
原创 哈夫曼编码
#include"iostream"#include"fstream"using namespace std;typedef struct node{ char x; int rchild ; int lchild; int weight; int parent;}Node;void bianma(Node *tree,int n);void yima(Node *tree,int n,int *a);int main(){ int i,n; fstream fl1,fl2; fl1.open("inp
2010-06-25 00:12:00
420
批处理系统中作业调度的模拟指导
2010-12-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人