Hdoj 5386 Cover

Source: Internet
Author: User

Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5386

A rather violent question backwards, and looked at the relationship with mathematics, but did not,

Don't think of it as a mathematical problem when you see a mathematical element in it, and it's possible to deduce it with programming ideas.

The problem is to do it backwards and violently, the problem of violence is not easy to debug,

Note that the input and output must not be problematic.

1#include <stdio.h>2 Const intMAXN1 = the;3 Const intMAXN2 =505;4 intT;5 intm, N;6 intA[MAXN1][MAXN1];7 CharOP[MAXN2];8 intope[maxn2][2];9 intMOP[MAXN2];Ten intT; One BOOLFlag; A Charch; - voidRead () { -scanf"%d%d",&n,&m); the      for(inti =0; I < n; ++i) -          for(intj =0; J < N; ++j) -scanf"%d",&a[i][j]); -      for(inti =0; I < n; ++i) +          for(intj =0; J < N; ++j) -scanf"%d",&a[i][j]); +      for(inti =0; I < m; ++i) { ACH =GetChar (); at          while(ch! ='H'&& ch! ='L') -CH =GetChar (); -Op[i] =ch; -scanf"%d%d", &ope[i][0],&ope[i][1]); -     } - } in intMain () { - //freopen ("A.txt", "R", stdin); toscanf"%d",&T); +      while(t--){ -t =0; the Read (); *          while(t<m) { $              for(intK =0; K < M; ++k) {Panax Notoginseng                 if(ope[k][0]){ -                     if(Op[k] = ='H'){ theFlag =1; +                          for(inti =0; I < n; ++i) { A                             if(a[ope[k][0]-1][i]! = ope[k][1] && a[ope[k][0]-1][i]) { theFlag =0; +                                  Break; -                             } $                         } $                         if(flag) { -                              for(inti =0; I < n; ++i) -a[ope[k][0]-1][i] =0; theope[k][0] =0; -mop[t++] =K;Wuyi                         } the                     } -                     if(Op[k] = ='L'){ WuFlag =1; -                          for(inti =0; I < n; ++i) { About                             if(a[i][ope[k][0]-1]! = ope[k][1] && a[i][ope[k][0]-1]){ $Flag =0; -                                  Break; -                             } -                         } A                         if(flag) { +                              for(inti =0; I < n; ++i) { thea[i][ope[k][0]-1] =0; -                             } $mop[t++] =K; theope[k][0] =0; the                         } the                     } the                 } -             } in         } the          for(inti = m1; I >=0; --i) { theprintf"%d", mop[i]+1); About             if(I! =0 ) theprintf" "); the         } theprintf"\ n"); +     } -}

Hdoj 5386 Cover

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.