自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Zachary的旅途

尽管我走的很慢,但我从未停止脚步。

  • 博客(30)
  • 资源 (3)
  • 收藏
  • 关注

原创 usaco Name That Number

<br /> <br />Name That Number<br />命名那个数字<br />译 by timgreen<br />在威斯康辛州牛大农场经营者之中,都习惯于请会计部门用连续数字给母牛打上烙印。<br />但是,母牛用手机时并没感到这个系统的便利,它们更喜欢用它们喜欢的名字来呼叫它们的同伴,而不是用像这个的语句"C'mon, #4734, get along."。<br />请写一个程序来帮助可怜的牧牛工将一只母牛的烙印编号翻译成一个可能的名字。<br />因为母牛们现在都有手机了,使用那标准

2011-05-31 22:00:00 501

原创 poj 3751时间日期格式转换

<br /> 时间日期格式转换Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4974 Accepted: 2284<br />Description世界各地有多种格式来表示日期和时间。对于日期的常用格式,在中国常采用格式的是“年年年年/月月/日日”或写为英语缩略表示的”yyyy/mm/dd”,此次编程大赛的启动日期“2009/11/07”就是符合这种格式的一个日期,而北美所用的日期格式则为“月月/日日/年年年年”或”mm/dd/yyyy”

2011-05-30 01:04:00 1008

原创 poj 2894 Ancient Keyboard

<br />题意:一个键盘含'A'-'Z'26个键,每个键上都有一个状态转化功能,默认为off,根据on状态的键的数量输出字符。 If there are i LEDs on, the ith letter of the English alphabet is written on the tape. For example, if three LEDs are on at a time step, a letter 'C' is written on the tape.(不重复)。<br />代码:<br

2011-05-29 16:32:00 926

原创 eclipse 如何显示行号、更改字体、大小

<br />打开eclipse后,单击window,选择preferences,展开General,展开Appearance,Color and Font里可以修改字体和大小。<br />和Appearance并列的一个是Editors,展开后有Text Editors,可修改是否显示行号。

2011-05-28 21:55:00 2653

原创 直线的裁剪算法

<br />import java.applet.*;import java.awt.*;public class caijian extends Applet{ int arrx[] = new int[5]; int arry[] = new int[5]; int i; int xx = 10,yy = 90; int xl = 50,yl=50,xb = 170,yb = 160; public void init() { arrx[0] = 50;

2011-05-28 09:17:00 1109

原创 poj 1281 MANAGER

<br />题意:进程管理,这里提供几种操作<br /> a x - add to the queue the process with the cost x; r - remove a process, if possible, from the queue according to the current manager policy; p i - enforce the policy i of the manager, where i is 1 or 2. The default manager po

2011-05-27 11:38:00 1062

原创 usaco Transformations

<br />Transformations<br />方块转换<br />译 by  TinyTony<br />一块N x N(1<=N<=10)正方形的黑白瓦片的图案要被转换成新的正方形图案。写一个程序来找出将原始<br />图案按照以下列转换方法转换成新图案的最小方式:<br />#1:转90度:图案按顺时针转90度。<br />#2:转180度:图案按顺时针转180度。<br />#3:转270度:图案按顺时针转270度。<br />#4:反射:图案在水平方向翻转(形成原图案的镜像)。<br />#

2011-05-26 19:44:00 1251

原创 虚拟地址转换成物理地址

<br />题目:<br />某虚拟存储器的用户空间共有32个页面,每页1K,主存16K,假定某时刻系统为用户的第0、1、2、3页分配的物理块号为5、10、4、7,而该用户作业的长度为6页,<br />将十六进制的虚拟地址0A5CH、103CH、1A5CH转换成物理地址。<br />页表:<br />页号0 1 2 3 4 5<br />物理块号5 1047<br /><br /><br />虚拟地址 0A5CH 二进制为 1010 0101 1100<br />因为每页1K,即 0100

2011-05-24 16:29:00 10181 2

原创 POJ 3510 string

<br />题意: 对某些特定字符转换<br />思路:优先判断特殊字符的转换,最后判断相应字符是否输出.<br />注意:结束符 "EOF"可以出现在任意位置.<br />代码:<br />#include <cstdio>#include <cstring>#include <iostream>using namespace std;int main(void){ char s[90]; char tmp[] = "floyd"; while(true) { g

2011-05-22 13:27:00 770

原创 usaco Milking Cows

<br /> <br />Milking Cows<br />挤牛奶<br />译 by Jeru<br />三个农民每天清晨5点起床,然后去牛棚给3头牛挤奶。第一个农民在300时刻(从5点开始计时,秒为单位)给他的牛挤奶,一直到1000时刻。第二个农民在700时刻开始,在 1200时刻结束。第三个农民在1500时刻开始2100时刻结束。期间最长的至少有一个农民在挤奶的连续时间为900秒(从300时刻到1200时刻),而最长的无人挤奶的连续时间(从挤奶开始一直到挤奶结束)为300秒(从1200时刻到1500

2011-05-21 01:51:00 798

原创 poj 1887 Testing the CATCHER

<br />20:14:09  2011-05-19<br />题意:求最长递减序列<br />思路:动态规划。dp[i] = max(dp[i],dp[j]+1|dp[i]<dp[j],0<j<i);<br />代码:<br />#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#include <cstdlib>using namespace std

2011-05-19 20:13:00 596

原创 POJ 1028 字符串

<br />题意:<br />浏览网页,这里有几种操作:<br />BACK: Push the current page on the top of the forward stack. Pop the page from the top of the backward stack, making it the new current page. If the backward stack is empty, the command is ignored. <br />FORWARD: Push the

2011-05-19 12:39:00 642

原创 POJ 1056 字符串

<br />题意:<br />对于输入的一串字符串,判断是否其中的的一个是另一个的前缀码<br />思路:数据量很小,对串排序后,枚举所有串两两表较就可以了<br />代码:<br />#include <iostream>#include <cstdio>#include <cstring>using namespace std;char str[15][15];int cmp(const void *a, const void *b){ return strcmp((char

2011-05-18 00:13:00 945

原创 usaco Broken Necklace字符串

<br /> <br />Broken Necklace<br />破碎的项链<br />译 by timgreen<br />你有一条由N个红色的,白色的,或蓝色的珠子组成的项链(3<=N<=350),珠子是随意安排的。 这里是 n=29的二个例子: 1 2 1 2 r b b r b r r b r

2011-05-11 01:27:00 786

原创 usaco Friday the Thirteenth

<br /> <br />黑色星期五<br />译 by 孖哥<br />13号又是星期五是一个不寻常的日子吗?<br />13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13<br />日落在星期一,星期二......星期日的次数.这个测试从1900年1月1日到<br />1900+n-1年12月31日.n是一个非负数且不大于400.<br />这里有一些你要知道的:1900年1月1日是星期一.4,6,11和9月有30天.其他月份除了2月有31天.闰年2月有29天,平年2月有28天

2011-05-10 01:56:00 779

原创 求n = a1*a2*33...*ak 且满足(1<a1<=a2<=a3...<=ak<=n)的状态数

<br />深度搜索+剪枝.<br />代码:#include <iostream>using namespace std;int ans;void dfs(int n, int k){ if(n == 1) { ans++; return; } int i; for(i=2; i<=n; ++i) if(n%i==0 && i>=k) dfs(n/i,i);}int main(void){ int n; while(cin

2011-05-09 11:29:00 794

原创 组合数学 C(n,k)

<br />求C(n,k)的方法很多,这里只介绍打表的方法.<br />递推式:C(n,k) = C(n-1,k-1) + C(n-1,k)<br />代码:<br />#include <iostream>using namespace std;const int MAX = 100;int c[MAX][MAX];int main() { int i,j; for(i=1; i<=1000; ++i) { c[i][0] = 1; c[i][1] = i; }

2011-05-09 00:11:00 7881

原创 边界标志算法

<br />边界填充算法中比较容易实现的算法--边界标志算法:<br />import java.awt.*;import java.applet.*;import java.awt.image.ImageProducer;import java.awt.image.MemoryImageSource;public class draw extends Applet { private static final long serialVersionUID = 1L; int

2011-05-07 08:54:00 5726

原创 usaco Greedy Gift Givers 字符串

<br />20:00:282011-05-06<br />题意:有中文网页,不解释.<br />思路:正常思维,模拟.<br />注意:取平均值时不能除零.<br />代码:<br />#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>using namespace std;int n;char name[11][20];int search(char s[]){ int

2011-05-06 20:00:00 658

原创 uva 10252Common Permutation

题意:给定两个字符串a,b,求a,b的最长公共子串,按字典顺序输出.思路:由于计数的只有小写字母,可以使用int数组将字符串的字符映射到数组上.通过比较两数组是否均含有某一字符,顺序输出。代码:#include #include #include using namespace std;char a[1010],b[1010];int la[27],lb[27];int min(int n, int m){ return n

2011-05-04 19:50:00 768

原创 poj 1002 字符串

<br />题意:电话拨号有不同的形式,其中的一种映射:<br />A, B, and C map to 2 <br />D, E, and F map to 3 <br />G, H, and I map to 4 <br />J, K, and L map to 5 <br />M, N, and O map to 6 <br />P, R, and S map to 7 <br />T, U, and V map to 8 <br />W, X, and Y map to 9 <br />对于输入的电

2011-05-04 12:51:00 486

原创 poj 1989 The Cow Lineup 数组

<br />题意:给定牛的类型的一组序列(类型范围1-k),其子序列有很多,求原序列不存在的最短子序列.例如: k = 5   类型序列 1 5 3 2 5 1 3 4 4 2 5 1 2 3. 长度为一的子序列1 2 3 4 5 原序列都有,长度为二的子序列也全有,当长度为3时, <br />2 2 4未出现.所以输出最短长度为3.<br />思路:<br />用一变量 ans 表示当前验证子序列长度,用一bool数组标识某类型是否被访问.<br />还有一点需要理解:只有当某一长度子序列的最后一种可能存

2011-05-03 22:33:00 899

原创 poj 1988 Cube Stacking 并查集

<br />题意:两种操作:  move : 将包含X的stack 至于包含Y的stack的栈顶.<br />      count:计数X所在stack的X的下面cube的数量.<br />思路:运用并查集.以栈底为根节点,parent[i]表示i的父节点,num[i]表示i 所在集合cube数量,rank[i]表示i 的度,即i下的cube的数量.<br />合并操作的时候,parent[x] = y(x放y之上).x下面增加了包含y的集合,所以x的度rank[x] 累加 num[y].同时以y为根节的

2011-05-03 20:14:00 561

原创 poj 1611 The Suspects 并查集

<br /> The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 10873 Accepted: 5158<br />DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To

2011-05-03 14:56:00 562

转载 poj 3067 Japan

<br />题意:日本东海岸有n个城市,西海岸有m个城市,现在要修建k条高铁连接东海岸的城市u和西海岸的城市v。问这k条高铁总共有多少个交点。<br />思路:树状数组。(本人未理解,装载供以后学习)<br />代码:<br />#include <iostream>#include <algorithm>#include <cstdio>using namespace std;const int MAX = 1009;typedef long long ll;ll arr[MAX]

2011-05-02 19:29:00 566

原创 poj 2406 KMP

<br />题意:给定一个串,求此串可由最多几个子串连接而成.<br />思路:套用模板next函数,若该串可由某子串连接而成,len(s)-next[len] 为子串长度(未能证明,自己写了几个例子,感觉是对的,相当不严谨)<br />代码:<br />#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int MAX = 1000009;int next[MAX];char

2011-05-02 14:56:00 391

原创 poj 2002 Squares

<br />题意:给出n个点,求这n个点能组成多少个不同正方形.<br />思路: 枚举+快查.(再次学习了快速查找)<br />代码:<br />#include <iostream>#include <algorithm>#include <cstdio>using namespace std;struct point{ int x,y;}p[1001],tmp;int cmp(point a, point b){ if(a.x == b.x) retur

2011-05-02 12:10:00 485

原创 hdu 3682To Be an Dream Architect

<br />思路:3D空间的一个点由X,Y,Z唯一表示,题目给出了空间大小,即n*n*n.那么,任意一个此空间的点可由唯一一个数值表示,最小点 1 = 1*1*1. 最大点为n*n*n。<br />注意:输入处理,可用getchar(),过滤无用信息。(本人想法),也可用scanf(),匹配输入格式 ,同时注意空行接收。<br />代码:<br />#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>

2011-05-02 09:58:00 661

原创 poj 1321 棋盘问题

<br />中文题目不解释.<br />思路:枚举每个可以放置的点,对该点进行深搜.满足题意方案数加1.<br />代码:<br />#include <iostream>#include <cstring>using namespace std;int n,k;bool map[9][9];bool row[9],col[9];int ans;void dfs(int d, int r){ int i,j; if(d==k) {

2011-05-01 23:07:00 441

原创 poj 2325 Persistent Numbers

<br />题目读了好长时间,郁闷。<br />题意:给定一个数N,求一个数M,要求:将M的各个位的数相乘得到N,M最小。<br />思路:用到高精度除法,将给定的数从9开始试除,接着试除8,7,6,5,4,3,2.若结果 N仍大于一位数,则说明N有大于10的质因子,否则,倒序输出试除到数。具体见代码。<br />(高精度除法套用别人的代码,不懂,汗!!)<br />代码:<br />#include <iostream>#include <cstdio>#include <cstring>us

2011-05-01 19:13:00 2081

精准农业汇报

掌握一定专业知识,有利于构建良好数据库和GIS开发

2011-11-18

[计算机图形学].(美国)Peter.Shirley.清晰版

[计算机图形学].(美国)Peter.Shirley.清晰版

2011-06-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除