The 16th question of codeforces water question 100 codeforces Round #164 (Div. 2) A. Games (brute force)

Source: Internet
Author: User

Title Link: Http://www.codeforces.com/problemset/problem/268/A
Test instructions: If the home team's home shirt is the same as the away shirt in the football match, then ask the team to put on their jerseys, now there are N teams, each team's home shirt and the color of the go shirt tell you, they are 22 more than a game. The number of matches where the home team wears away jerseys.
C + + code:

#include <iostream>using namespacestd;Const intMAXN = -;intX[MAXN], Y[MAXN], n, ans;intMain () {CIN>>N;  for(inti =0; i< N; i++) Cin>> X[i] >>Y[i];  for(inti =0; i< N;i + +)         for(intj =0; j<n; J + +)        {            if(i = = j)Continue; if(X[i] = =Y[j]) ans++; } cout<<ans; return 0;}
C + +

The 16th question of codeforces water question 100 codeforces Round #164 (Div. 2) A. Games (brute force)

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.