上一页 1 2 3 4 5 6 7 ··· 11 下一页
摘要: LG. 1003 铺地毯题意分析给出平面中地毯的左上角坐标和长宽,然后给出一点(x,y)。求此点最上面是哪个地毯的编号,若没被覆盖则输出-1.将所有地毯的信息存在一个结构体中,由于后埔地毯在上面,在查询的时候,要倒着查询,若查询到就输出地毯编号,否则输出-1.代码总览#include... 阅读全文
posted @ 2017-07-26 15:52 pengwill 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Educational Codeforces Round 25A.Binary Protocol题意分析给出一种新的表示数字的方法,根据1和0来表示。首先是一个数字n,表示01串的长度。接下来是一个n个数的01串。 表示的规则 1. 开头一定是1 2. 0表示分隔 3. 0分隔的区间... 阅读全文
posted @ 2017-07-17 19:26 pengwill 阅读(118) 评论(0) 推荐(0) 编辑
摘要: POJ.3268 Silver Cow Party (Dijkstra)题意分析稍后补代码总览#include #include #include #include #include #include #include #define nmax 1005#define inf 1e8... 阅读全文
posted @ 2017-07-12 22:35 pengwill 阅读(82) 评论(0) 推荐(0) 编辑
摘要: POJ.1797 Heavy Transportation (Dijkstra变形)题意分析给出n个点,m条边的城市网络,其中 x y d 代表由x到y(或由y到x)的公路所能承受的最大重量为d,求从1到n的所有通路中,所能经过的的最大重量的车为多少。2. 代码总览#include ... 阅读全文
posted @ 2017-07-12 21:10 pengwill 阅读(94) 评论(0) 推荐(0) 编辑
摘要: POJ. 2253 Frogger (Dijkstra )题意分析首先给出n个点的坐标,其中第一个点的坐标为青蛙1的坐标,第二个点的坐标为青蛙2的坐标。给出的n个点,两两双向互通,求出由1到2可行通路的所有步骤当中,步长最大值。在dij原算法的基础上稍作改动即可。dij求解的是单源最... 阅读全文
posted @ 2017-07-12 18:28 pengwill 阅读(105) 评论(0) 推荐(0) 编辑
摘要: POJ.2387 Til the Cows Come Home (SPFA)题意分析首先给出T和N,T代表边的数量,N代表图中点的数量图中边是双向边,并不清楚是否有重边,我按有重边写的。直接跑spfa,dij,floyd都可以。求1到N的最短路。代码总览#include #inclu... 阅读全文
posted @ 2017-07-12 14:14 pengwill 阅读(98) 评论(0) 推荐(0) 编辑
摘要: POJ.1287 Networking (Prim)题意分析可能有重边,注意选择最小的边。编号依旧从1开始。直接跑prim即可。代码总览#include #include #define nmax 105#define inf 1e8+7using namespace std;int... 阅读全文
posted @ 2017-07-10 21:55 pengwill 阅读(94) 评论(0) 推荐(0) 编辑
摘要: HDU.1233 还是畅通工程(Prim)题意分析首先给出n,代表村庄的个数然后出n*(n-1)/2个信息,每个信息包括村庄的起点,终点,距离,要求求出最小生成树的权值之和。注意村庄的编号从1开始即可直接跑prim代码总览#include #define nmax 105#defin... 阅读全文
posted @ 2017-07-10 20:42 pengwill 阅读(93) 评论(0) 推荐(0) 编辑
摘要: HDU.1596 find the safest road (Floyd)题意分析与普通的最短路不太相同,本题有些许的变化。 1. 要找到由i到j最安全的路,故在求解的时候要保证mp[i][j]尽量大,而不是尽量小。 2. 当mp[i][j] = 0的时候表示无法通过,而不是为无穷大... 阅读全文
posted @ 2017-07-06 21:02 pengwill 阅读(113) 评论(0) 推荐(0) 编辑
摘要: HUD.2544 最短路 (Dijkstra)题意分析1表示起点,n表示起点(或者颠倒过来也可以)建立无向图从n或者1跑dij即可。代码总览#include #define nmax 110#define inf 1e8using namespace std;int mp[nmax]... 阅读全文
posted @ 2017-07-06 19:47 pengwill 阅读(141) 评论(0) 推荐(0) 编辑
摘要: HDU.1874 畅通工程续 (Dijkstra)题意分析坑点比较多 1. 某两点之间可能有多条通路,在跑Dij时需要用距离最小的算。 2. 当起点和重点相等的时候,距离为0 3. 点的编号从0开始。代码总览#include #define nmax 210using namespa... 阅读全文
posted @ 2017-07-06 19:11 pengwill 阅读(133) 评论(0) 推荐(0) 编辑
摘要: POJ.1003 Hangover ( 水 )代码总览#include #include #include #include #include #include #include #define nmaxusing namespace std;vector v;void init(... 阅读全文
posted @ 2017-06-20 13:11 pengwill 阅读(86) 评论(0) 推荐(0) 编辑
摘要: POJ. 1005 I Think I Need a Houseboat(水 )代码总览#include #include #include #include #include #include #define nmaxusing namespace std;const double... 阅读全文
posted @ 2017-06-20 13:10 pengwill 阅读(87) 评论(0) 推荐(0) 编辑
摘要: POJ.2739 Sum of Consecutive Prime Numbers(水)代码总览#include #include #include #include #define nmax 10005using namespace std;int prime[nmax],n;ve... 阅读全文
posted @ 2017-06-20 13:07 pengwill 阅读(84) 评论(0) 推荐(0) 编辑
摘要: POJ.1552 Doubles(水)题意分析暴力代码总览#include #include #define nmax 100using namespace std;int a[nmax];int n;int main(){ //freopen("in.txt","r",std... 阅读全文
posted @ 2017-06-20 13:06 pengwill 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 大学计算机模拟考试常见试题与解析(一)第一题答案 AA错在是以o开头而非0开头 以0开头数字是表示8进制,如013表示十进制的11.D, 5L表示长整型的5第二题答案 C 考察的是C语言的除法特性,只保留整数位,如1/2 = 0,此题用排除法较易。 不妨设a=1,b=2; A 选项 ... 阅读全文
posted @ 2017-06-02 17:30 pengwill 阅读(202) 评论(0) 推荐(0) 编辑
摘要: A题 贪心+dfs dfs求出每个分割后小块中小孔的个数,除2是能安装芯片的个数,累加即可#include #define nmax 105using namespace std;int mp[nmax][nmax];int sx[] = {0,1,0,-1};int sy[] = ... 阅读全文
posted @ 2017-05-30 14:06 pengwill 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 2017计蒜之道 预赛 第一场A16种情况手动暴力即可#include #define nmax 7using namespace std;int mp[nmax][nmax];int n,m;int cnt = 0;void ge(){ cnt++;}void check()... 阅读全文
posted @ 2017-05-20 21:46 pengwill 阅读(146) 评论(0) 推荐(0) 编辑
摘要: POJ.1006 Biorhythms (拓展欧几里得+中国剩余定理)题意分析不妨设日期为x,根据题意可以列出日期上的方程:化简可得:根据中国剩余定理求解即可。代码总览#include #include #include #include using namespace std;ty... 阅读全文
posted @ 2017-05-19 17:43 pengwill 阅读(145) 评论(0) 推荐(0) 编辑
摘要: POJ.2142 The Balance (拓展欧几里得)题意分析现有2种质量为a克与b克的砝码,求最少 分别用多少个(同时总质量也最小)砝码,使得能称出c克的物品。设两种砝码分别有x个与y个,那么有ax+by=c。可用拓展欧几里得求解。若x与y均为正数,说明在天平的同一侧,否则在不... 阅读全文
posted @ 2017-05-19 12:50 pengwill 阅读(175) 评论(0) 推荐(0) 编辑
摘要: POJ.1061 青蛙的约会 (拓展欧几里得)题意分析我们设两只小青蛙每只都跳了X次,由于他们相遇,可以得出他们同余,则有:代码总览#include #include #include #include using namespace std;typedef long long ll... 阅读全文
posted @ 2017-05-18 21:43 pengwill 阅读(136) 评论(0) 推荐(0) 编辑
摘要: CodeForces 185A. Plant (矩阵快速幂)题意分析求解N年后,向上的三角形和向下的三角形的个数分别是多少。如图所示:N=0时只有一个向上的三角形,N=1时有3个向上的三角形,1个向下的三角形,N=2,有10个向上的三角形和6个向下的三角形。根据递推关系,设an为第N... 阅读全文
posted @ 2017-05-18 21:25 pengwill 阅读(122) 评论(0) 推荐(0) 编辑
摘要: HDU.2256 Problem of Precision (矩阵快速幂)题意分析代码总览#include #include #include #include #include #include #include #include #include #include #define... 阅读全文
posted @ 2017-05-17 00:03 pengwill 阅读(90) 评论(0) 推荐(0) 编辑
摘要: HDU.2640 Queuing (矩阵快速幂)题意分析不妨令f为1,m为0,那么题目的意思为,求长度为n的01序列,求其中不含111或者101这样串的个数对M取模的值。 用F(n)表示串长为n的合法串的个数。 首先不难通过枚举发现F(0) = 0, F(1) =2, F(3) = ... 阅读全文
posted @ 2017-05-16 23:48 pengwill 阅读(252) 评论(0) 推荐(0) 编辑
摘要: HDU.1757 A Simple Math Problem (矩阵快速幂)点我挑战题目题意分析给出一个递推式: 1.x9时,f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10). 现在想让你求解f(k)... 阅读全文
posted @ 2017-05-16 01:50 pengwill 阅读(89) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 11 下一页