标签:out div col include blog span else amp algo
一开始还以为概率dp什么的,最后想了想。卧槽,这就是一道dfs水题
#include <cstdio> #include <algorithm> int Out[105]; int Can[4]; int Max=-1,use; void dfs(int pos,int ans){ if(pos>3){ Out[ans]++; return; } else for(int i=1;i<=Can[pos];i++){ dfs(pos+1,ans+i); } } int main(){ scanf("%d%d%d",&Can[1],&Can[2],&Can[3]); dfs(1,0); for(int i=1;i<=100;i++){ if(Out[i] > Max){ Max = Out[i]; use = i; } } printf("%d\n",use); }
[DFS] BZOJ 1599 [Usaco2008 Oct]笨重的石子
标签:out div col include blog span else amp algo
原文地址:http://www.cnblogs.com/OIerLYF/p/7625558.html