HDU-2063 (simple binary matching)

Source: Internet
Author: User

This is suitable for comrades who just got started with binary matching. 0 .-!

I won't talk about the meaning of the question. I mainly want to talk about the problem of zengguang road. In fact, it is also quite understandable from zengguang Road, why did you find a way to satisfy your previous questions and find a way to meet your needs?

In fact, the new knowledge point is the concept of saving the road. the path is not always fixed. If there is better, we still need to update it. I think this is the essence of zengguang Road?

Paste the Code:

# Include <stdio. h> # include <string. h> # include <stdlib. h> # include <math. h> int n, m, K; int map [505] [505]; int link [505]; int visit [505]; int getnum (int x) {for (INT I = 1; I <= m; I ++) {If (! Visit [I] & map [x] [I]) {visit [I] = 1; if (! Link [I] | getnum (link [I]) {link [I] = x; return 1 ;}} return 0 ;}int main () {While (scanf ("% d", & K), k) {scanf ("% d", & N, & M); int COUNT = 0; int A, B; memset (MAP, 0, sizeof (MAP); memset (link, 0, sizeof (Link); For (INT I = 1; I <= K; I ++) {scanf ("% d", & A, & B); map [a] [B] = 1 ;} for (Int J = 1; j <= N; j ++) {memset (visit, 0, sizeof (visit); If (getnum (j )) count ++;} printf ("% d \ n", count);} 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.