题意:给你一个数n每一步这个数可以变为他的因子,直到这个数变为1,求n变到1的期望步数。分析:dp[i],表示i变为1的期望步数,dp[1]=0,dp[n]是答案。dp[i]=sum(dp[j])/tmp+1;(j是i的因子,tmp是i因子的个数化简即可#include #include #incl...
分类:
其他好文 时间:
2015-08-18 11:39:06
阅读次数:
111
Curious Robin HoodTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%lld & %lluSubmitStatusDescriptionRobin Hood likes to loot rich people since he...
分类:
其他好文 时间:
2015-08-17 21:37:51
阅读次数:
130
题目链接: Lightoj 1174 - Commandos题目描述: 有一军队秉承做就要做到最好的口号,准备去破坏敌人的军营。他们计划要在敌人的每一个军营里都放置一个炸弹。军营里有充足的士兵,每个士兵都可以携带充足的炸弹,问这个军队完成任务最少需要时间?(假设士兵在往敌军帐篷里放炸弹时,敌军不.....
分类:
其他好文 时间:
2015-08-17 21:15:37
阅读次数:
129
题目大意: 给你n天要穿的衣服,可以套着穿,但是一旦脱下来就不能载穿了,问n天至少需要多少衣服?做了两个关于区间dp的题,遇到这个题还是不会做,网上搜了一下,感觉也不难,就是自己想不起来。。。思路:dp[i][j]表示从第i天到第j天至少需要多少衣服,那么dp[i][j] = dp[i + 1][j...
分类:
其他好文 时间:
2015-08-17 21:12:20
阅读次数:
147
Curious
Robin Hood
Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another trick. He keeps n sacks where h...
分类:
编程语言 时间:
2015-08-17 19:38:35
阅读次数:
172
1094 - Farthest Nodes in a Tree
PDF (English)
Statistics
Forum
Time Limit: 2 second(s)
Memory Limit: 32 MB
Given a tree (a connected graph with no cycles), yo...
分类:
其他好文 时间:
2015-08-17 17:20:59
阅读次数:
155
1112 - Curious Robin Hood
PDF (English)
Statistics
Forum
Time Limit: 1 second(s)
Memory Limit: 64 MB
Robin Hood likes to loot rich people since he helps the p...
分类:
编程语言 时间:
2015-08-17 17:17:00
阅读次数:
148
LightOJ 1132题意:给出N(1≤N≤1015),K(0≤K≤50);给出N (1 ≤ N ≤ 10^{15}) , K (0 ≤ K ≤ 50);
计算:(1K+2K+3K+...+NK)%232.计算:(1^K + 2^K + 3^K + ... + N^K) \% 2^{32}.思路:根据二项式定理,我们可以得到:
(n+1)k=C0knk+C1knk?1+C2knk?2+...+...
分类:
其他好文 时间:
2015-08-17 01:14:22
阅读次数:
185
区间dp的第一题-----看题解看了好多~~终于看懂了---55555dp[i][j] 表示第i天到第j天至少需要多少件衣服那么第i件衣服只被第i天占用的话, dp[i][j] = dp[i+1][j] + 1如果不只被第i天占用的话,那么假设在第k天和第i天穿一样的衣服,dp[i][j] = dp...
分类:
其他好文 时间:
2015-08-16 22:45:57
阅读次数:
118
DescriptionThe people ofMohammadpurhave decided to paint each of their houses red, green, or blue. They've also decided that no two neighboring houses...
分类:
其他好文 时间:
2015-08-16 21:07:14
阅读次数:
136