上一页 1 ··· 14 15 16 17 18
摘要: Problem ATime Limit : 2000/1000ms (Java/Other)Memory Limit : 20000/10000K (Java/Other)Total Submission(s) : 26Accepted Submission(s) : 15Problem Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去 阅读全文
posted @ 2013-07-30 19:11 龚细军 阅读(1268) 评论(0) 推荐(1) 编辑
摘要: LovekeyTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4640Accepted Submission(s): 1493Problem DescriptionXYZ-26进制数是一个每位都是大写字母的数字。 A、B、C、…、X、Y、Z 分别依次代表一个0 ~ 25 的数字,一个 n 位的26进制数转化成是10进制的规则如下A0A1A2A3…An-1 的每一位代表的数字为a0a1a2a3…an-1 ,则该XYZ-26进制数的10进制值就为 阅读全文
posted @ 2013-07-28 09:36 龚细军 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 转载http://www.cppblog.com/converse/archive/2009/10/05/97905.html二分查找算法基本思想二分查找算法的前置条件是,一个已经排序好的序列(在本篇文章中为了说明问题的方便,假设这个序列是升序排列的),这样在查找所要查找的元素时,首先与序列中间的元素进行比较,如果大于这个元素,就在当前序列的后半部分继续查找,如果小于这个元素,就在当前序列的前半部分继续查找,直到找到相同的元素,或者所查找的序列范围为空为止.用伪代码来表示, 二分查找算法大致是这个样子的:1 left = 0, right = n -12 while (left t: ... 阅读全文
posted @ 2013-07-26 13:26 龚细军 阅读(5277) 评论(2) 推荐(0) 编辑
摘要: Flyod 算法(两两之间的最短路径)动态规划方法,通过相邻矩阵, 然后把最后的结果存在这么一个矩阵里面,(i,j),#include #include using namespace std;#define M 301#define LIM 200000000int w[M][M],d[2][M][M];void floyd(int g[M][M],int d[2][M][M],int n){ int i,j,k; for(i=1;id[u]+duv) d[v]=d[u]+duv;}void dijkstra(int g[M][M],int d[M],int n,int s){ //n is 阅读全文
posted @ 2013-07-26 12:57 龚细军 阅读(600) 评论(0) 推荐(0) 编辑
摘要: DiscountTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 984Accepted Submission(s): 591Problem DescriptionAll the shops use discount to attract customers, but some shops doesn’t give direct discount on their goods, instead, they give discount only w 阅读全文
posted @ 2013-07-26 10:38 龚细军 阅读(302) 评论(1) 推荐(0) 编辑
摘要: Holding Bin-Laden Captive!Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11977Accepted Submission(s): 5354Problem DescriptionWe all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported 阅读全文
posted @ 2013-07-25 10:30 龚细军 阅读(327) 评论(0) 推荐(0) 编辑
摘要: Ignatius's puzzleTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5035Accepted Submission(s): 3426 Problem DescriptionIgnatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes th 阅读全文
posted @ 2013-07-24 20:09 龚细军 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 数的长度时间限制:3000 ms | 内存限制:65535 KB难度:1描述 N!阶乘是一个非常大的数,大家都知道计算公式是N!=N*(N-1)······*2*1.现在你的任务是计算出N!的位数有多少(十进制)?输入首行输入n,表示有多少组测试数据(n#include#includeusing namespace std;int main(){ int t,n; cin>>t; while(t--) { scanf("%d",&n); int num=log10(sqrt(4.0*acos(0 阅读全文
posted @ 2013-07-24 12:29 龚细军 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 悼念512汶川大地震遇难同胞——老人是真饿了Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5466Accepted Submission(s): 2308 Problem Description时间:5008年5月16日(震后第4天) 地点:汶川县牛脑寨 人物:羌族老奶奶【转载整理】牛脑寨是一个全村600多人的羌族寨子,震后几天,这里依然能常常听到隆隆的声音,那是对面山上石头不断滑落的声音。在完成整个突击队的抢修移动基站的任务后,我提着相机 阅读全文
posted @ 2013-07-24 08:03 龚细军 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 汉诺塔(一)时间限制:1000 ms | 内存限制:65535 KB难度:3描述在印度,有这么一个古老的传说:在世界中心贝拿勒斯(在印度北部)的圣庙里,一块黄铜板上插着三根宝石针。印度教的主神梵天在创造世界的时候,在其中一根针上从下到上地穿好了由大到小的64片金片,这就是所谓的汉诺塔。不论白天黑夜,总有一个僧侣在按照下面的法则移动这些金片:一次只移动一片,不管在哪根针上,小片必须在大片上面。僧侣们预言,当所有的金片都从梵天穿好的那根针上移到另外一根针上时,世界就将在一声霹雳中消灭,而梵塔、庙宇和众生也都将同归于尽。现在请你计算出起始有m个金片的汉诺塔金片全部移动到另外一个针上时需要移动的最少步 阅读全文
posted @ 2013-07-23 16:37 龚细军 阅读(293) 评论(0) 推荐(0) 编辑
摘要: Coin ChangeTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10590Accepted Submission(s): 3535Problem DescriptionSuppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given a 阅读全文
posted @ 2013-07-22 11:42 龚细军 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 单词数Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21651Accepted Submission(s): 5228Problem Descriptionlily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。Outp 阅读全文
posted @ 2013-07-22 10:28 龚细军 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 最少乘法次数时间限制:1000ms | 内存限制:65535KB难度:3描述给你一个非零整数,让你求这个数的n次方,每次相乘的结果可以在后面使用,求至少需要多少次乘。如24:2*2=22(第一次乘),22*22=24(第二次乘),所以最少共2次;输入第一行m表示有m(1 2 using namespace std; 3 int main() 4 { 5 int m; 6 cin>>m; 7 while(m--) 8 { 9 int n;10 cin>>n;11 int count=0;12 while(... 阅读全文
posted @ 2013-07-21 16:10 龚细军 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 韩信点兵时间限制:3000ms | 内存限制:65535KB难度:1描述相传韩信才智过人,从不直接清点自己军队的人数,只要让士兵先后以三人一排、五人一排、七人一排地变换队形,而他每次只掠一眼队伍的排尾就知道总人数了。输入3个非负整数a,b,c ,表示每种队形排尾的人数(a 2 using namespace std; 3 int main() 4 { 5 unsigned short int a,b,c; 6 cin>>a>>b>>c; 7 a=(15*c+21*b+70*a)%105; 8 if(a>=10&&a<=100) 9 阅读全文
posted @ 2013-07-21 15:47 龚细军 阅读(343) 评论(0) 推荐(0) 编辑
摘要: A == B ?Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 49403Accepted Submission(s): 7593 Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test case contains t 阅读全文
posted @ 2013-07-20 23:04 龚细军 阅读(464) 评论(2) 推荐(0) 编辑
摘要: 蛇形填数时间限制:3000ms | 内存限制:65535KB难度:3描述在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方陈为: 10 11 12 1 9 16 13 2 8 15 14 3 7 6 5 4输入直接输入方陈的维数,即n的值。(n 2 int main(void ) 3 { 4 int n; 5 scanf("%d",&n); 6 int m=1,i=-1,j=n-1; 7 int snack[101][101]={0}; 8 while(m0&&snack[i][j-1]==0)15 {16 ... 阅读全文
posted @ 2013-07-20 20:35 龚细军 阅读(358) 评论(0) 推荐(0) 编辑
摘要: Climbing WormTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9964Accepted Submission(s): 6553Problem DescriptionAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minut 阅读全文
posted @ 2013-07-20 10:55 龚细军 阅读(235) 评论(0) 推荐(0) 编辑
摘要: The Hardest Problem EverTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13035Accepted Submission(s): 5905Problem DescriptionJulius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In 阅读全文
posted @ 2013-07-20 10:49 龚细军 阅读(1085) 评论(3) 推荐(0) 编辑
摘要: Integer InquiryTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9196Accepted Submission(s): 2354Problem DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 阅读全文
posted @ 2013-07-19 20:37 龚细军 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Robot MotionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5011Accepted Submission(s): 2321Problem DescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid dow 阅读全文
posted @ 2013-07-19 16:35 龚细军 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 康托展开: 对于全排列中形成的一个数组,可以知道他是排列中的第几种...具体公式为:X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0! 其中,a为整数数组,并且0 2 #include 3 using namespace std; 4 int main() 5 { 6 int arr[12]={1},t,i,j,count; 7 long long sum; 8 for(i=1;i>t;12 while(t--)13 {14 scanf("%s",str);15 sum=0;... 阅读全文
posted @ 2013-07-19 12:14 龚细军 阅读(584) 评论(0) 推荐(0) 编辑
摘要: Computer TransformationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4842 Accepted Submission(s): 1769 Problem DescriptionA sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the c 阅读全文
posted @ 2013-07-19 10:13 龚细军 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 做道题,并没有太多的技巧,关键在与对Accepted,presented error 和wa的判断,第一步如果两者完全一样,那么很定是AC了 ,否则如果去掉多余换行,空格,制表后还有不同说明是数据 不同,就wa,如果相同就是pe了........ Online JudgeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4121Accepted Submission(s): 1550 Problem Description... 阅读全文
posted @ 2013-07-18 13:02 龚细军 阅读(273) 评论(0) 推荐(0) 编辑
摘要: god is a girlTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1135Accepted Submission(s): 514 Problem DescriptionOne day,when I was dreaming,god went into my dream,she was pretty cute,just like /^_^\... I really wanted to talked to her,but my Engli 阅读全文
posted @ 2013-07-17 16:51 龚细军 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 2013-07-17 10:50:38DaydreamTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1423Accepted Submission(s): 404 Problem DescriptionWelcome to 2009 HDU Girl’s Cup, bless you will happy in it. Every girl are beautiful if you use you heart to feel. Every 阅读全文
posted @ 2013-07-17 11:01 龚细军 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Binary String Matching时间限制:3000ms | 内存限制:65535KB难度:3描述Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B? For example, the text string B is ‘1001110110’ while the pattern string A is ‘11’, you should output 3 阅读全文
posted @ 2013-07-16 15:37 龚细军 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 括号配对问题时间限制:3000ms | 内存限制:65535KB难度:3描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0#include#includetypedef struct NODE{ char a; struct NODE *next ;}Node;int main( void ){ int n,t,flag; Node *head,*p1,*p2; scanf("%d",&t); getchar(); while(t--) { head=NULL; flag=n=0; p1=p2=(Node*)malloc(sizeof(N 阅读全文
posted @ 2013-07-16 11:20 龚细军 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 最小公倍数时间限制:1000 ms | 内存限制:65535 KB难度:3描述为什么1小时有60分钟,而不是100分钟呢?这是历史上的习惯导致。但也并非纯粹的偶然:60是个优秀的数字,它的因子比较多。事实上,它是1至6的每个数字的倍数。即1,2,3,4,5,6都是可以除尽60。我们希望寻找到能除尽1至n的的每个数字的最小整数m.输入多组测试数据(少于500组)。 每行只有一个数n(1#include#includeusing namespace std ;const int maxn=80;const int Nin=100;int arr[502][maxn+3];int save[maxn 阅读全文
posted @ 2013-07-15 23:14 龚细军 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 汉诺塔IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3675 Accepted Submission(s): 1830 Problem Description经典的汉诺塔问题经常作为一个递归的经典例题存在。可能有人并不知道汉诺塔问题的典故。汉诺塔来源于印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往上按大小顺序摞着64片黄金圆盘。上帝命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘 阅读全文
posted @ 2013-07-15 22:50 龚细军 阅读(614) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18