1、LightOJ 1012 Guilty Prince 简单bfs 2、总结:水 题意:迷宫,求有多少位置可去 #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm> #inc ...
分类:
其他好文 时间:
2016-09-04 20:42:11
阅读次数:
123
题目链接:http://lightoj.com/volume_showproblem.php?problem=1074 题意:有n个城市,每个城市有一个拥堵值a[i],m条单向路u到v,从u到v所需时间是(a[v]-a[u])^3, q个查找,查找从起点1到点u的最短时间是多少;如果不能到达或者时间 ...
分类:
其他好文 时间:
2016-08-31 22:12:44
阅读次数:
619
Description A queue is a data structure based on the principle of 'First In First Out' (FIFO). There are two ends; one end can be used only to insert ...
分类:
其他好文 时间:
2016-08-30 16:00:57
阅读次数:
170
1138 - Trailing Zeroes (III) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, ...
分类:
其他好文 时间:
2016-08-28 11:08:40
阅读次数:
150
题意:就是求一个树的直径,也就是求任意两点的最大距离。 做法:跑两遍DFS,详见代码。 ...
分类:
其他好文 时间:
2016-08-24 19:01:53
阅读次数:
170
题目链接:http://lightoj.com/volume_showproblem.php?problem=1149 方法:二分匹配,求最大匹配数 ...
分类:
其他好文 时间:
2016-08-23 16:51:34
阅读次数:
211
Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1030 uDebug Description You are in a cave, a long ca ...
分类:
其他好文 时间:
2016-08-20 10:04:51
阅读次数:
127
题目大意:给出面积n,和最短边m,求能形成的矩形的个数(不能为正方形)。 题目思路:根据算数基本定理有: 1.每个数n都能被分解为:n=p1^a1*p2^a2*^p3^a3……pn^an(p为素数); 2.n的正因数的个数sum为:sum=(1+a1)*(1+a2)*(1+a3)……(1+an); ...
分类:
其他好文 时间:
2016-08-19 23:49:50
阅读次数:
174
题目大意:f(x)=n 代表1-x中与x互质的数字的个数。给出n个数字a[i],要求f(x)=a[i],求x的和。 思路:每个素数x 有x-1个不大于x的互质数。则f(x)=a[i],若a[i]+1为素数则x=a[i]+1,否则a[i]++直到得到素数位置。 #include<cstdio> #in ...
分类:
其他好文 时间:
2016-08-19 23:47:24
阅读次数:
141
Description You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold. Initial ...
分类:
其他好文 时间:
2016-08-19 13:04:09
阅读次数:
161