A day algorithm programming problem (1)--NetEase written "engineer's work arrangement"

Source: Internet
Author: User

First, understand the title meaning: Everyone can only work on the list of one job and two people can not do a job at the same time.
AC thinking: The use of violence to enumerate each possible allocation scheme, the resolution of sub-problems gradually upward solve the problem of the mother, the final solution.

Standard range Notdeep (cattle and Guest network)
Links: https://www.nowcoder.com/discuss/22696?type=6&order=0&pos=5&page=2

1#include <bits/stdc++.h>2 3 using namespacestd;4 5vector<string> A;//a Save work sequence list6 intN;7 intb[Ten];//flag Array B[i] is used to record whether work with number I has been assigned, 0 is assigned, 1 is not assigned8 intRet//record number of allocation plans9 Ten voidDfsinti) {//Dfs[i] means assigning work to people numbered I to a.size () 1 when the person with the number 0 to I-1 has been assigned a job . One     if(i = =a.size ()) { Aret++;//end of an allocation scheme -}Else { -          for(intj =0; J < A[i].size (); J + +) { the             if(B[a[i][j]-'0']) { -B[A[I][J]-'0'] =0; -DFS (i +1); -B[A[I][J]-'0'] =1; +             } -         } +     } A } at  - intMain () { -  -      while(Cin >>N) { -          for(inti =0; I < n; i++) { -             stringX CIN >>x; in a.push_back (x); -         } to          for(inti =0; I <Ten; i++) B[i] =1; +RET =0; -Dfs0); thecout << ret <<Endl; *     } $     return 0;Panax Notoginseng}

A day algorithm programming problem (1)--NetEase written "engineer's work arrangement"

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.