为什么我暴力wa了2点????

P2736 [USACO3.4] “破锣摇滚”乐队 Raucous Rockers

还是一样的。。。wa too ```cpp #include <iostream> #include <cstdlib> #include <cstdio> #include <cmath> #include <cstring> using namespace std; int n,t,m,a[30],ans; void dfs(int x,int num,int tleft,int book) { if (book+n-x<=ans) return; if (num==m || x==n) {ans=max(ans,book); return;} for (int i=x+1;i<=n;i++) { if (a[i]+tleft<=t) dfs(i,num,a[i]+tleft,book+1); if (a[i]<=t && num+1<=m) dfs(i,num+1,a[i],book+1); dfs(i,num,tleft,book); } } int main() { scanf("%d%d%d",&n,&t,&m); for (int i=1;i<=n;i++) scanf("%d",&a[i]); dfs(0,0,0,0); printf("%d",ans); return 0; } ```
by syh0313 @ 2017-10-26 16:24:44


排个序按顺序拿都能骗到wa俩点
by 源流光 @ 2018-04-21 20:37:19


排个序按顺序拿都能骗到wa俩点
by alexlu @ 2019-12-15 11:02:14


|