Light OJ_51CTO博客
【题意】大意就是一个人要从0点走到n-1点,路中有些点有商店可以买礼物,所以这个人想买多点礼物,但是又要尽快的走到n-1点,这两者之间呢,礼物的多少优先,其次是路程长度。【分析】16个点显然是可以状压的,dp[sta][i]表示当前遍历的点的状态sta停留在shop[i]的最短路的估计值。这样状态首先是可以表示完全的,转移就显然很简单了。先预处理出每个商店到其他点的最短路径,以便后面的状态转移的需
原创 2022-04-20 10:23:17
60阅读
Time Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %lluSubmitStatusPracticeLightOJ 1138DescriptionYou task is to find minimal natural numberN...
转载 2015-09-20 11:32:00
269阅读
2评论
离谱,我居然在想组合数学的事情 讨论某个数ai在该排列中出现的次数 c(2,n)+c(3,n)+...c(n,n); 贡献: ai*[1*c(1,n)+2*c(2,n)+3*c(3,n)+...n*c(n,n)]*n的k次方; 正解:后面那串等价于每次排列的个数*总排列数/n(每个ai都是对称的) ...
转载 2021-10-18 20:19:00
110阅读
2评论
不得不吐槽light这个傻逼oj.. 开ll超时,开int re 刚开始想是对于n的每一个因子,枚举是i取到它的最大值还是j取到最大值 就有2的k次方,k为因子数目 然后对于已经确定了谁是取最大值后,另一个可以选0到ai,其中ai为该因子的个数 选择就是ai+1种 # 正解是连乘(符号不会打)(2* ...
转载 2021-10-18 20:44:00
85阅读
2评论
Description You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a ball into a basket from a cer
转载 2017-06-18 14:43:00
126阅读
2评论
倍增法LCA + DP#include#include#includeusing namespace std;const int N = 100010;int val[N];int p[N][18];int main(){ int t,T,; for(t=1;t<=T;t++){ sca
原创 2023-09-15 09:25:25
46阅读
https://vjudge.net/problem/LightOJ-1074 首先吐槽一个单词,directional是有方向的,undirectional是无向的,这个unidirectional是tm单向的。。。。好吧我又学会一个单词。 由于有负边权,用spfa好啦,判断负环时不要遇见就ret
转载 2017-08-14 18:37:00
74阅读
2评论
#include #include #include #include #include using namespace std;int main(){ int t; scanf("%d",&t); int s=1; while (t--) { int a ,b; scanf ("%d%d",&a,&b)
原创 2023-03-03 12:36:52
84阅读
求最大的指数. 刚开始以为要素因数分解后每个因子的数目都相同才有可能 这是最特殊的情况.. 考虑这几个数目的最大公因数M 构造: 对gcd还是没啥概念,怀疑指数运算不过关,六百连夜把我抓回去重修 ...
转载 2021-10-18 20:29:00
57阅读
2评论
免费做一样新1004 - Monkey Banana Problem 号码塔1005 - Rooks 排列1013 - Love Calculator LCS变形dp[i][j][k]对于第一个字符串i 到jLCS为k的方案数1068 - Investigation 数位dp 能被K整数且各位数字之...
转载 2015-07-02 12:07:00
120阅读
2评论
K - Get the ContainersTime Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %lluSubmit Status Practice LightOJ 1076DescriptionA conveyor belt has a number of vessel
原创 2022-11-22 00:01:49
47阅读
1148 - Mad Counting PDF (English) Statistics Forum Time Limit: 0.5 second(s)Memory Limit: 32 MBMob was hijacked by the mayor of the Town "TruthTown"...
转载 2015-10-25 22:07:00
73阅读
2评论
1116 - Ekka DokkaPDF (English)StatisticsForumTime Limit:2 second(s)Memory Limit:32 MBEkka and his friend Dokka decided to buy a cake. They both love c...
转载 2015-12-03 17:30:00
44阅读
2评论
传送门 1199 - Partitioning Game PDF (English) Statistics Forum Time Limit: 4 second(s) Memory Limit: 32 MB Alice and Bob are playing a strange game. The
转载 2017-08-14 19:59:00
123阅读
2评论
1214 - Large DivisionPDF (English)StatisticsForumTime Limit:1 second(s)Memory Limit:32 MBGiven two integers,aandb, you should check whetherais divisib...
转载 2015-12-03 22:10:00
39阅读
2评论
学过简单动态规划的人应该对最长公共子序列的问题很熟悉了,这道题只不过多加了一条字符串变成三条了,还记得,只要把状态变成三维的即可。//http://lightoj.com/volume_showproblem.php?problem=1159//2013-08-15-09.50#include #include #include #include using namespace
原创 2022-07-18 16:00:06
60阅读
1354 - IP Checking PDF (English) Statistics Forum Time Limit: 2 second(s)Memory Limit: 32 MBAn IP address is a 32 bit address formatted in the follo...
转载 2015-11-09 13:24:00
209阅读
2评论
题目链接:http://lightoj.com/volume_showproblem.php?problem=1422很简单的区间DP的入门题。一开始这题想了很久就是想不出来。直到做了后面几道区间DP回过来终于想明白了。区间DP可以使用记忆化搜索和直接DP的方法写。这题的状态转移方程:dp[i][j]=min(1+dp[i+1][j],dp[i+1][k-1]+dp[k][j]) ( a[i]==a[k] i<k<=j )注意初始化。/* * Light OJ 1422 - Halloween Costumes * http://lightoj.com/volume_showpro
转载 2013-04-29 22:52:00
76阅读
2评论
1080 - Binary Simulation​​​​​​PDF (English)​​​​Statistics​​​​Forum​​Time Limit: 2 second(s)Memory Limit: 64 MBGiven a binary number, we are about to do some operations on the number. Two types of oper
原创 2022-01-12 09:43:57
75阅读
思路:先从n行里面选择m行,然后再乘上一个全排列A(n,m)就行了#includeusin
原创 2023-06-09 18:26:28
34阅读
  • 1
  • 2
  • 3
  • 4
  • 5