Poj 1270 Following Orders enumeration Arrangement

Source: Internet
Author: User

Poj 1270 Following Orders enumeration Arrangement

Question:

To give a character set and the relationship between some characters, find all possible arrangements on the character set.

Analysis:

The brute-force enumeration can be divided into enumeration subsets, enumeration sorting, and enumeration combination. This is a simple enumeration arrangement. During the enumeration process, you can use the smaller than the relationship to pruning.

Code:

 

// Poj 1270 // sep9 # include

 
  
# Include using namespace std; char vars [64], constraint [256], ans [64]; int g [128] [128], vis [256]; int len; void dfs (int cur) {if (cur = len) {puts (ans); return;} for (int I = 0; I

  
   
= 'A' & vars [I] <= 'Z') vars [len ++] = vars [I]; vars [len] = '\ 0 '; ans [len] = '\ 0'; sort (vars, vars + len); dfs (0); puts ("");} return 0 ;}

  

 


 

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.