2013年1月27日

摘要: Description World Wide Flyer has landing rights at several airports throughout the world. They wish to place their central hub at the airport that minimizes the maximum direct flying distance from the hub to any other airport in the world. InputInput consists of a line containing n <= 1000, the n 阅读全文
posted @ 2013-01-27 01:24 蛙蛙 阅读(244) 评论(0) 推荐(0)
摘要: 描述Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a word. When 阅读全文
posted @ 2013-01-27 01:09 蛙蛙 阅读(182) 评论(0) 推荐(0)
摘要: 某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文的学生均可获得;2) 五四奖学金,每人4000元,期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)的学生均可获得;3) 成绩优秀奖,每人2000元,期末平均成绩高于90分(>90)的学生均可获得;4) 西部奖学金,每人1000元,期末平均成绩高于85分(>85)的西部省份学生均可获得;5) 班级贡献奖,每人850元,班级评议成绩高于80分(>80 阅读全文
posted @ 2013-01-27 00:35 蛙蛙 阅读(162) 评论(0) 推荐(0)

2013年1月19日

摘要: 描述Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长的滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-...-3-2-1更长。事实上,这是最长的一条。输入输入的 阅读全文
posted @ 2013-01-19 18:54 蛙蛙 阅读(142) 评论(0) 推荐(0)
摘要: 描述:有n个数,找出其中和为t的组合个数,如n=5,5个数分别为1,2,3,4,5。 t=5;那么组合有1+4=5;2+3=5;5=5.总共3种。这是一道枚举的水题,每个数只有选或者不选的可能,只要把所有的数全都枚举遍即可。#include <stdio.h>#include <stdlib.h>int n, t;int a[1000];int num=0;void dp(int x,int y)//x代表第i个数,一代表前i个数的和的大小{ if(y==t) { num++; return; } if(y>t||x>n) return; if(y<t 阅读全文
posted @ 2013-01-19 13:44 蛙蛙 阅读(123) 评论(0) 推荐(0)

2013年1月17日

摘要: 描述:一个4*4的棋盘棋子有黑和白两种状态,每次可以对任意点操作,改变它本身和上下左右(如果有的话)棋子的颜色,求最少多少次操作可以把棋盘变成同一颜色。 方法:枚举,深度搜索,输入用C++的cin比较好,本人是用C输入的,有点拙计#include <stdio.h>#include <stdlib.h>int qipan[4][4];int c=33;void shuru(){ int i; char a1[5],a2[5],a3[5],a4[5]; scanf("%s\n%s\n%s\n%s",&a1,&a2,&a3,&am 阅读全文
posted @ 2013-01-17 14:25 蛙蛙 阅读(512) 评论(0) 推荐(0)