随笔分类 - DP
摘要:描述 程序员常常需要给变量命名、给函数命名、给项目命名、给团队命名…… 好的名字可以大大提高程序员的主观能动性,所以很多程序员在起名时都会陷入纠结和烦恼。 小Hi希望给新的项目起个拉风的名字。他希望这个名字可以包含N个关键字,并且总长度最短。例如包含关键字abcd、cdab和dabc的最短字符串是c
阅读全文
摘要:数学期望 P=Σ每一种状态*对应的概率。 因为不可能枚举完所有的状态,有时也不可能枚举完,比如抛硬币,有可能一直是正面,etc。在没有接触数学期望时看到数学期望的题可能会觉得很阔怕(因为我高中就是这么认为的,对不起何老板了QwQ),避之不及。 但是现在发现大多数题就是手动找公式或者DP推出即可,只要
阅读全文
摘要:描述 小Ho面前有N个小球排成了一排。每个小球可以被染成M种颜色之一。 为了增强视觉效果,小Ho希望不存在连续K个或者K个以上的小球颜色一样。 你能帮小Ho计算出一共有多少种不同的染色方法么? 例如N=4, M=2, K=3,则有10种染色方法: 0010 0011 0100 0101 0110 1
阅读全文
摘要:Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satis
阅读全文
摘要:There are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosen some paths and wants to
阅读全文
摘要:King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday
阅读全文
摘要:495. Kids and Prizes Time limit per test: 0.25 second(s) Memory limit: 262144 kilobytes input: standard output: standard ICPC (International Cardboard
阅读全文
摘要:The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing i
阅读全文
摘要:BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sid
阅读全文
摘要:In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them meet. Nothing will happen if they are of the same species, tha
阅读全文
摘要:Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl). Homura wants to help her friend Madoka save the world. But because of the plot of the Boss
阅读全文
摘要:When wake up, lxhgww find himself in a huge maze. The maze consisted by N rooms and tunnels connecting these rooms. Each pair of rooms is connected by
阅读全文
摘要:Background If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and t
阅读全文
摘要:Time limit per test: 2.0 seconds Memory limit: 512 megabytes Time limit per test: 2.0 seconds Memory limit: 512 megabytes Time limit per test: 2.0 sec
阅读全文
摘要:问题: Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets
阅读全文
摘要:时间限制:24000ms 单点时限:3000ms 内存限制:256MB 时间限制:24000ms 单点时限:3000ms 内存限制:256MB 描述 给定 n 和 k。计算有多少长度为 k 的数组 a1, a2, ..., ak,(0≤ai) 满足: a1 + a2 + ... + ak = n。
阅读全文
摘要:时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Given a directed graph containing n vertice (numbered from 1 to n) and m edges. Can you tell us how many differ
阅读全文
摘要:问题: Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where h
阅读全文
摘要:问题 Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atom
阅读全文
摘要:问题 The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hir
阅读全文

浙公网安备 33010602011771号