这道题是一个状压动归题.子集生成,每一位表示是否选择了第$i$个数. 转移:$f[S] = \sum f[S-\{x\}]$且$x\in S$,当该子集所有元素的和为$b_1$或$b_2$时不转移. 初始化:$f[\{\}]=1$,其他为$0$. 目标:$f[全集]$. 注意常数即可. #include <bits/stdc++.h> using namespace std; #define re register #define rep(i, a, b) for (re int i = a;…
描述 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…
Travel PP loves travel. Her dream is to travel around country A which consists of N cities and M roads connecting them. PP has measured the money each road costs. But she still has one more problem: she doesn't have enough money. So she must work dur…