2015-11-01

Source: Internet
Author: User

Today, when the topological sort is written, the bool type returns the value of the function that has no return result until the end of WA, later found foolish. If the compiler does not have the-wall option, it is difficult to find, so you should pay attention later.

The first two days to do a stack expression encountered a string problem, to convert a string into a single char for the switch as a parameter, but I can not think of a good way, but I think c_str this function is OK.

Switch(Expr[cur].c_str () [0]){     Case '+': Result.push (R1+R2); Break;  Case '-': Result.push (R1-R2); Break;  Case '*': Result.push (R1*R2); Break;  Case '/': Result.push (R1/R2); Break;}

char * C_STR () returns a character pointer, so take its first character, denoted by [0].

Some time ago also made two points to find, in fact, not simple, boundary conditions are not necessarily all (L<r) (l<=r) and I do three questions should be (L+1<r) a neighboring state exit, and then after the while to judge.

There is also the maximum matching of the binary graph, using the Hungarian algorithm, notice the IF judgment of the augmented path in DFS, and the meaning of the two arrays, one is the right endpoint matches which point, and one is whether the left endpoint is used in this search.

1 BOOLDfsintx) {2      for(intI=0; I<g[x].size (); i++){3         intv=G[x][i];4         if(Vis[v])Continue; vis[v]=true;5         if(matching[v]==-1||DFS (Matching[v])) {6matching[v]=x;7             return true;8         }9     }Ten     return false; One } A voidsolve () { -     intans=0; -memset (matching,-1,sizeof(matching)); the      for(intI=1; i<=n;i++){ -memset (Vis,0,sizeof(Vis)); -         if(Dfs (i)) ans++; -     } +cout<<ans<<Endl; -}

Haven't written a blog for a long time, some have done encountered problems are a little to remember, so in the future to update the blog to record these problems, first of all.

2015-11-01

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.