你发现 pizza 种类数不会很多,状压一下就可以了 code: #include <bits/stdc++.h> #define M 11 #define N 100005 #define LL long long using namespace std; int n,m,cnt; int v[1<<M],tmp[M],id[1<<M],a1[1<<M],a2[1<<M]; LL val[1<<M]; LL mer[1<<…
CF1185F Two Pizzas 洛谷评测传送门 题目描述 A company of nn friends wants to order exactly two pizzas. It is known that in total there are 99 pizza ingredients in nature, which are denoted by integers from 11 to 99 . Each of the nn friends has one or more favori…
描述 Bob loves Pizza but is always out of money. One day he reads in the newspapers that his favorite pizza restaurant, Alfredo's Pizza Restaurant, is running a competition: they will donate a big pizza to the first person who will tell them the lowest…
题目链接:http://poj.org/problem?id=3311 Hie with the Pie Time Limit: 2000MS Memory Limit: 65536K Total Submissions:12225 Accepted: 6441 Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortuna…
Hie with the Pie Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. He will wait for 1 or more (up to…
[BZOJ1688][Usaco2005 Open]Disease Manangement 疾病管理 Description Alas! A set of D (1 <= D <= 15) diseases (numbered 1..D) is running through the farm. Farmer John would like to milk as many of his N (1 <= N <= 1,000) cows as possible. If the mil…
经典状压DP. f[i][j][k]=sum(f[i-1][j-cnt[k]][k]); cnt[i]放置情况为i时的国王数量 前I行放置情况为k时国王数量为J #include <iostream> #include <cstdio> using namespace std; #define N 1<<9 long long ans; int n,m; int ok_1[N],cnt[N]; int ok_2[N][N]; ][*+][N]; void init()…
!!!!!!! 第一次学状压DP,其实就是运用位运算来实现一些比较,挺神奇的.. 为什么要发“!!!”因为!x&y和!(x&y)..感受一下.. #include <iostream> #include <cstdio> #include <cstring> #define N 13 #define M 1<<13 #define MOD 1000000000 using namespace std; int n,m,t,ans; int s…
Escape Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 9430 Accepted Submission(s): 2234 Problem Description 2012 If this is the end of the world how to do? I do not know how. But now scient…
状压DP Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of his paper was filled with squares…
Relocation Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2631 Accepted: 1075 Description Emma and Eric are moving to their new house they bought after returning from their honeymoon. Fortunately, they have a few friends helping them…
状压DP :F(S)=Sum*F(S)+p(x1)*F(S^(1<<x1))+p(x2)*F(S^(1<<x2))...+1; F(S)表示取状态为S的牌的期望次数,Sum表示什么都不取得概率,p(x1)表示的是取x1的概率,最后要加一因为有又多拿了一次.整理一下就可以了. #include <cstdio> ; <<Maxn],p[Maxn]; int n; int main() { while (scanf("%d",&n)!…