2010年12月15日

摘要: 本题使用记忆话递归即可,也可以用动态规划DP不过得使用三维数组,空间复杂度比较高Function Run FunTime Limit:1000MSMemory Limit:10000DescriptionWe all love recursion! Don't we?Consider a three-parameter recursive function w(a, b, c):if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns:1if a > 20 or b > 20 or c > 20, 阅读全文
posted @ 2010-12-15 21:04 yming0221 阅读(159) 评论(0) 推荐(0)

2010年12月13日

摘要: Big NumberTime Limit:1000MSMemory Limit:65536KTotal Submissions:17518Accepted:5541DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to 阅读全文
posted @ 2010-12-13 16:42 yming0221 阅读(180) 评论(0) 推荐(0)
摘要: ;*******************************;;* 中断实验 *;;*******************************;data segmentmess db 'TPCA interrupt!',0dh,0ah,'$'data endscode segmentassume cs:code,ds:datastart: mov ax,cs mov ds,ax mov dx,offset int3 ;USB设备中断为IRQ3 mov ax,250bh ;设置中断3的中断矢量 int 21h cli ;CPU清中断标志位 in al... 阅读全文
posted @ 2010-12-13 16:14 yming0221 阅读(177) 评论(0) 推荐(0)
摘要: ;************************;;*8251串行通讯(自发自收)*;;************************;data segmentio8253a equ 280hio8253b equ 283hio8251a equ 2b8hio8251b equ 2b9hmes1 db 'you can play a key on the keybord!',0dh,0ah,24hmes2 dd mes1data endscode segment assume cs:code,ds:datastart: mov ax,data mov ds,ax mov d 阅读全文
posted @ 2010-12-13 16:13 yming0221 阅读(212) 评论(0) 推荐(0)
摘要: POJ 1496 Word IndexTime Limit:1000MSMemory Limit:10000KTotal Submissions:3035Accepted:1731DescriptionEncoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with f 阅读全文
posted @ 2010-12-13 13:14 yming0221 阅读(217) 评论(0) 推荐(0)

2010年12月11日

摘要: DescriptionUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ...shows the first 10 ugly numbers. By convention, 1 is included.Given the integer n,write a program to find and print the n'th ugly number.InputEach line of the input contains 阅读全文
posted @ 2010-12-11 16:56 yming0221 阅读(123) 评论(0) 推荐(0)

2010年12月10日

摘要: 用整型,直接int a;a=a+(a+1)/2;相当于float a;a*1.5=a;ceil(a); 阅读全文
posted @ 2010-12-10 21:39 yming0221 阅读(178) 评论(0) 推荐(0)

2010年12月9日

摘要: 当初把Floyd算法的最外层循环写到最里层了,囧~~~~#include<stdio.h> #define MAX 1000000 int opt[102][102]; int vertexnum; void Floyd() { int _i,_j,_k; for(_j=1;_j<=vertexnum;_j++) for(_k=1;_k<=vertexnum;_k++) for(_i=1;_i<=vertexnum;_i++) { if(opt[_i][_k]+opt[_k][_j]... 阅读全文
posted @ 2010-12-09 22:06 yming0221 阅读(98) 评论(0) 推荐(0)
摘要: Jumping CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:4477Accepted:2705DescriptionFarmer John's cows would like to jump over the moon, just like the cows in their favorite nursery rhyme. Unfortunately, cows can not jump.The local witch doctor has mixed up P (1 <= P <= 150,000) 阅读全文
posted @ 2010-12-09 11:12 yming0221 阅读(150) 评论(0) 推荐(0)

2010年12月7日

摘要: 本题就是让你输出N位的二进制数中不包含两个连续的1的个数DP瞬秒!!!关键是找到DP方程假设二进制序列为a1,a2,a3,........a(i-2),a(i-1),a(i)opt[i]表示i位二进制数中符合上述特性的数字个数则可得到opt[i]=opt[i-1]+opt[i-2]因为,如果a(i)为0,则,opt[i]=opt[i-1]如果a(i)为1,那么a(i-1)一定为0,则,opt[i]=opt[i-2]动态规划的题目关键就是找到合适的状态转移方程#include<stdio.h>int opt[50];int binary[10];void decimal_to_bin 阅读全文
posted @ 2010-12-07 15:22 yming0221 阅读(160) 评论(0) 推荐(0)

导航