摘要: Problem Description There is a n×m board, a chess want to go to the position (n,m) from the position (1,1).The chess is able to go to position (x2,y2) 阅读全文
posted @ 2016-08-05 17:15 大领主 阅读(187) 评论(0) 推荐(0) 编辑
摘要: P is a permutation of the integers from 1 to N(index starting from 1).Here is the code of Bubble Sort in C++. After the sort, the array is in increasi 阅读全文
posted @ 2016-07-29 09:08 大领主 阅读(341) 评论(0) 推荐(0) 编辑
摘要: Bo is a "Life Winner".He likes playing chessboard games with his girlfriend G.The size of the chessboard is N×M.The top left corner is numbered(1,1) a 阅读全文
posted @ 2016-07-28 10:47 大领主 阅读(229) 评论(0) 推荐(0) 编辑
摘要: Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there 阅读全文
posted @ 2016-07-27 11:25 大领主 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Professor Zhang draws n points on the plane, which are conveniently labeled by 1,2,...,n. The i-th point is at (xi,yi). Professor Zhang wants to know 阅读全文
posted @ 2016-07-26 09:46 大领主 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题意就是让0号和n+1号主机通信,通过(proxy)代理服务器进行中转 当0号和n+1号直接相连且延时是最短的,则输出0,(注意是最短延时) 当0号和n+1号主机无法通过任何方式通信,则输出-1 当0号和n+1号主机可以通过代理服务器相连且有多条路径,则在这多条路径中选出和0号主机直接相连的最小代理 阅读全文
posted @ 2016-07-18 15:23 大领主 阅读(244) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std; const int maxnum = 100;const int maxint = 999999; void Dijkstra(int n, int v, int *dist, int *prev, int c[maxn 阅读全文
posted @ 2016-05-26 09:10 大领主 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 1777年法国科学家布丰提出的一种计算圆周率的方法——随机投针法,即著名的布丰投针问题。 投针步骤 投针步骤 这一方法的步骤是: 1) 取一张白纸,在上面画上许多条间距为a的平行线。 2) 取一根长度为l(l=a/2) 的针,随机地向画有平行直线的纸上掷n次,观察针与直线相交的次数,记为m 3)计算 阅读全文
posted @ 2016-04-19 21:26 大领主 阅读(399) 评论(0) 推荐(0) 编辑
摘要: long long int c[600][600];void init(){ memset(c, 0, sizeof(c)); for (int i = 0; i <= 505; i++) { c[i][1] = i; c[i][0] = 1; } for (int i = 2; i <= 500; 阅读全文
posted @ 2016-04-11 19:01 大领主 阅读(223) 评论(0) 推荐(0) 编辑
摘要: #include#include#includeint map1[30][30],degree[30],p[30];int tuopu(int n){ int i,j,k,b[30],x=0,flog=1; for(i=1; i1)//检查入度为0的点有几个 { ... 阅读全文
posted @ 2015-11-18 18:29 大领主 阅读(288) 评论(0) 推荐(0) 编辑