(match) Fire Net--hdu--1045

Source: Internet
Author: User

Link:

http://acm.hdu.edu.cn/showproblem.php?pid=1045

Http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82834#problem/A

A look at the original question, first with a search to write, or to learn to match it!

Previous code:

#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespacestd;#defineN 10#defineINF 0x3f3f3f3fintN, ans;CharG[n][n];BOOLJudgeintXinty) {    inti; if(g[x][y]=='X')        return false;  for(I=x; i>=0; i--)    {        if(g[i][y]=='X')             Break; if(g[i][y]=='D')            return false; }     for(I=y; i>=0; i--)    {        if(g[x][i]=='X')             Break; if(g[x][i]=='D')            return false; }    return true;}voidDFS (intZintk) {    intx, y; X= z/N; Y= z%N; if(z==n*N) {ans=Max (ans, k); return ; }    if(judge (x, Y)) {G[x][y]='D'; DFS (Z, K+1); G[x][y]='.'; } DFS (Z+1, k);}intMain () { while(SCANF ("%d", &N), N) {inti; memset (G,0,sizeof(G));  for(i=0; i<n; i++) scanf ("%s", G[i]); Ans=0; DFS (0,0); printf ("%d\n", ans); }    return 0;}

(match) Fire Net--hdu--1045

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.