"Usaco" Mother ' s Milk (search)

Source: Internet
Author: User

At first, I was thinking about the problem of heavy, and found that the background data seems to be no duplication of cases = =

/*id:18906421lang:c++prog:milk3*/#include <cmath> #include <cstdio> #include <vector> #include < algorithm>using namespace Std;const int maxn = 25;int Vis[maxn][maxn][maxn] = {0};vector<int>ans;int cnt = 0,aa,b    B,cc;int move_to (int v,int v1,int v2) {//V1, v2 int left = V-V2;    if (V1 > left) return to left; else return v1;}    void Dfs (int a,int b,int c) {if (vis[a][b][c]) return;    VIS[A][B][C] = 1;    if (a = = 0) ans.push_back (c);    int D;    A-b d = move_to (bb,a,b);    DFS (a-d,b + d,c);    A-c D = move_to (cc,a,c);    DFS (a-d,b,c + D);    B-a D = move_to (aa,b,a);    DFS (A + d,b-d,c);    B-C D = move_to (cc,b,c);    DFS (a,b-d,c + D);    C-A D = move_to (aa,c,a);    DFS (A + d,b,c-d);    C-B d = move_to (bb,c,b);    DFS (A, B + d,c-d); return;}    int main () {freopen ("milk3.in", "R", stdin);    Freopen ("Milk3.out", "w", stdout); scanf ("%d%d%d",&aa,&bb,&CC);    DFS (0,0,CC);    Sort (Ans.begin (), Ans.end ());        for (int i = 0; i < ans.size (); i++) {if (i) printf ("");    printf ("%d", ans[i]);    } puts (""); return 0;}

"Usaco" Mother ' s Milk (search)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.