随笔分类 - 动态规划 状压dp
摘要:4197: [Noi2015]寿司晚宴 Description 为了庆祝 NOI 的成功开幕,主办方为大家准备了一场寿司晚宴。小 G 和小 W 作为参加 NOI 的选手,也被邀请参加了寿司晚宴。 在晚宴上,主办方为大家提供了 n−1 种不同的寿司,编号 1,2,3,…,n−1,其中第 i 种寿司的美
阅读全文
摘要:Free from square Problem Description There is a set including all positive integers that are not more then n. HazelFan wants to choose some integers f
阅读全文
摘要:零件组装 描述 现有n个零件,小Y花费了很多时间来收集它们,现在他想把零件拼在一起,拼完就可以召唤神龙了。已知零件之间存在相邻的关系,拥有相邻关系的零件在最终的组装结果中就是相邻的,并且组装过程中每次只能通过相邻关系来组合零件。小Y每次可以选择两个零件(也可以是两个零件块,或一个零件与一个零件块)拼
阅读全文
摘要:题意 腾讯推出了一款益智类游戏――消消乐。游戏一开始,给定一个长度为n的序列,其中第i个数为A[i], 游戏的目标是把这些数全都删去,每次删除的操作为:选取一段连续的区间,不妨记为[L,R], 如果这一段区间内所有数的最大公约数 >= k(k的值在游戏的一开始会给定),那么这一段区间就能被直接删去。
阅读全文
摘要:D. Felicity's Big Secret Revealed The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know a
阅读全文
摘要:Wireless Password Problem Description Liyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. L
阅读全文
摘要:题目链接:http://codeforces.com/contest/766/problem/E Examples input 3 1 2 3 1 2 2 3 out 10 题意: 给你一棵n个点的树,每个点有点权,求所有不同的路径异或和的总和 题解: DP 任选一个root,设定dp[i][j][
阅读全文
摘要:1001题意:n个人,给m对敌对关系,X个好人,Y个坏人。现在问你是否每个人都是要么是好人,要么是坏人。 先看看与X,Y个人有联通的人是否有矛盾,没有矛盾的话咋就继续遍历那些不确定的人关系,随便取一个数3,与其相连的就是4,间隔就要相同,dfs搜过去就可以判断了 #include<bits/stdc
阅读全文
摘要:1072: [SCOI2007]排列perm Description 给一个数字串s和正整数d, 统计s有多少种不同的排列能被d整除(可以有前导0)。例如123434有90种排列能被2整除,其中末位为2的有30种,末位为4的有60种。 给一个数字串s和正整数d, 统计s有多少种不同的排列能被d整除(
阅读全文
摘要:Sitting in Line Problem Description 度度熊是他同时代中最伟大的数学家,一切数字都要听命于他。现在,又到了度度熊和他的数字仆人们玩排排坐游戏的时候了。游戏的规则十分简单,参与游戏的N个整数将会做成一排,他们将通过不断交换自己的位置,最终达到所有相邻两数乘积的和最大的
阅读全文
摘要:题目链接: http://bestcoder.hdu.edu.cn/contests/contest_show.php?cid=701 1001 : 矩阵快速幂 #include <iostream> #include <algorithm> #include <cstdio> #include <
阅读全文
摘要:D. Kefa and Dishes When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows t
阅读全文
摘要:Problem 1608 - Calculation Description Today, Alice got her math homework again! She had n integers, and she needed to divide them into several piles
阅读全文
摘要:Hackers’ Crackdown Miracle Corporations has a number of system services running in a distributed computer system which is a prime target for hackers.
阅读全文
摘要:有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市可以走多次),最后还要回到0点(他的单位),请问最短时间是多少。现在已知任意两个城市的直接通路的时间。 第一行一个正整数n
阅读全文
摘要:F Fighting for Triangles DescriptionAndy and Ralph are playing a two-player game on a triangular board that looks like the following:1 234 ...
阅读全文
摘要:Corn FieldsTime Limit:2000MSMemory Limit:65536KDescriptionFarmer John has purchased a lush new rectang...
阅读全文

浙公网安备 33010602011771号