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