题目链接:http://www.codeforces.com/problemset/problem/268/A
题意:足球比赛中如果主场球队的主场球衣和客队的客队球衣颜色一样,那么要求主队穿上他们的可对球衣,现在有n个球队,每一球队的主场球衣和客场球衣的颜色都告诉你了,它们两两之间要比一场赛。求其中主队穿客场球衣的比赛场数。
C++代码:

#include <iostream>
using namespace std;
const int maxn = ;
int x[maxn], y[maxn], n, ans;
int main()
{
cin >> n;
for (int i = ; i< n; i++)
cin >> x[i] >> y[i];
for (int i = ; i< n;i ++)
for (int j = ; j<n; j ++)
{
if (i == j) continue;
if (x[i] == y[j])
ans ++;
}
cout << ans;
return ;
}

C++

codeforces水题100道 第十六题 Codeforces Round #164 (Div. 2) A. Games (brute force)的更多相关文章

  1. codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)

    题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...

  2. codeforces水题100道 第二十五题 Codeforces Round #197 A. Helpful Maths (Div. 2) (strings)

    题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include ...

  3. codeforces水题100道 第二十四题 Codeforces Beta Round #85 (Div. 2 Only) A. Petya and Strings (strings)

    题目链接:http://www.codeforces.com/problemset/problem/112/A题意:忽略大小写,比较两个字符串字典序大小.C++代码: #include <cst ...

  4. codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)

    题目链接:http://www.codeforces.com/problemset/problem/118/A题意:字符串转换……C++代码: #include <string> #inc ...

  5. codeforces水题100道 第十九题 Codeforces Round #109 (Div. 2) A. I_love_%username% (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/155/A题意:找到当前最大值或者最小值出现的次数.“当前”的意思差不多是a[i]大于所有a[j]( ...

  6. codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...

  7. codeforces水题100道 第十五题 Codeforces Round #262 (Div. 2) A. Vasya and Socks (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/460/A题意:Vasya每天用掉一双袜子,她妈妈每m天给他送一双袜子,Vasya一开始有n双袜子, ...

  8. codeforces水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...

  9. codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/122/A题意:判断一个数是否能被一个lucky number整除,一个lucky number是一 ...

随机推荐

  1. Spring JDBC批量操作

    以下示例将演示如何使用spring jdbc进行批量更新.我们将在单次批次操作中更新student表中的记录. student表的结果如下 - CREATE TABLE student( id INT ...

  2. 图形界面至少要有一个顶级Swing容器

    图形界面至少要有一个顶级Swing容器 顶级Swing容器为其它Swing组件在屏幕上的绘制和处理事件提供支持 常用的顶级容器: JFrame(框架):表示主程序窗口 JDialog(对话框):每个J ...

  3. iOS: 自动增高的 textView

    如 iPhone 内应用“信息”的输入框一样,输入文字过多或者输入换行,输入框可以随着内容自动变化.主要是计算内容的尺寸并相应更改输入框的frame.具体表现在: 更改输入框的 frame.origi ...

  4. ubuntu下安装和配置apache2+SVN的详细方法介绍

    ubuntu安装和配置SVN第一步:安装apache2  libapache2-svn subversionsudo apt-get install apache2sudo apt-get insta ...

  5. Asp.net中文本框全选的实现

    一.鼠标滑过textbox全选 前台: <asp:TextBox runat="server" onMouseOver="this.focus();this.sel ...

  6. VCL 中的 Windows API 函数(5): AlphaBlend

    AlphaBlend 是指定图像混合透明的函数, 在 Graphics.GraphUtil.RibbonStyleActnCtrls 单元用到. 下面的测试是把一张图片显示在窗体, 并可以调整透明度. ...

  7. Java学习之——Java Serializable

    1.什么是Serializable接口? http://en.wikipedia.org/wiki/Serialization Java 提供了一种对象序列化的机制,该机制中,一个对象可以被表示为一个 ...

  8. SpringMVC工作原理详解

    先来看一下什么是 MVC 模式 MVC 是一种设计模式. MVC 的原理图如下: SpringMVC 简单介绍 SpringMVC 框架是以请求为驱动,围绕 Servlet 设计,将请求发给控制器,然 ...

  9. Python 面向对象详解

    Python从设计之初就已经是一门面向对象的语言,正因为如此,在Python中创建一个类和对象是很容易的.本章节我们将详细介绍Python的面向对象编程. 如果你以前没有接触过面向对象的编程语言,那你 ...

  10. phpcms v9 添加内容出现500错误

    今天开发好一个网站,上传网站后,不知道安装的时候要求fsockopen()函数打开,我直接跳过安装完成的,所以搞得后面出错了,我一直以为这个问题,今天花了一天的时间找资料,测试,终于知道什么原因了,其 ...