CF 432B :Football Kit
hash做法:
#include<stdio.h>
#include<string.h>
const int Max = ;
int home[Max],away[Max],hash[Max];
int main()
{
int n,sum,total;
int i,j;
while(scanf("%d",&n)!=EOF)
{
sum = ;
total = *(n-);
for(i=;i<n;i++)
scanf("%d %d",&home[i],&away[i]);
memset(hash,,sizeof(hash));
for(i=;i<n;i++)
hash[home[i]]++;//重复出现的主场number
for(i=;i<n;i++)
printf("%d %d\n",n-+hash[away[i]],n--hash[away[i]]); }
return ;
}
CF 432B :Football Kit的更多相关文章
- CodeForces 432B Football Kit
Football Kit Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Subm ...
- 432B - Football Kit
解题思路: 暴力绝对TLE 一个队伍穿主场球衣的次数 = 这个队伍的客场球衣颜色与其他队主场球衣颜色起冲突的次数 + (n - 1) #include <stdio.h> #include ...
- Codeforces Round #246 (Div. 2) —B. Football Kit
B. Football Kit time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #246 (Div. 2) B. Football Kit
题目的意思是求出每个队穿主场衣服和客场衣服的次数 每个队作为主场的次数是n-1,作为客场的次数是n-1 当每个队打主场的时候肯定穿的主场衣服 当每个队打客场时,如果客场与主场的衣服不同,则穿客场衣服 ...
- codeforces 432 B Football Kit
题意:给出n支球队,主场的衣服的颜色x[i],客场的衣服的颜色y[i],每只队伍会打n-1次主场,n-1次客场,当这只队伍打客场的衣服颜色和对手一样的时候,那么他们要穿上主场的衣服 问每个球队主场球服 ...
- CODEFORCE 246 Div.2 B题
题目例如以下: B. Football Kit time limit per test 1 second memory limit per test 256 megabytes input stand ...
- CF 1244 C - The Football Season
C - The Football Season 先考虑求解 \[ x\times w + y\times d=p \] 若存在一组解 \[ \begin{cases} x_0\\ y_0 = kw + ...
- 第8章 Foundation Kit介绍
本文转载至 http://blog.csdn.net/mouyong/article/details/16947321 Objective-C是一门非常精巧实用的语言,目前我们还没有研究完它提供的全 ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
随机推荐
- CodeForces - 156C:Cipher (不错的DP)
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But t ...
- Communication System(动态规划)
个人心得:百度推荐的简单DP题,自己做了下发现真得水,看了题解发现他们的思维真得比我好太多太多, 这是一段漫长的锻炼路呀. 关于这道题,我最开始用DP的思路,找子状态,发现自己根本就不会找DP状态数组 ...
- 如何找回未保存过的 Excel 文件?
如何找回未保存过的 Excel 文件? 同事做了一个文件,未保存直接关闭,正常是找不回来的. 但是 Excel 有一个强大的自动保存功能,对没有保存的文件也可以找回.
- Linux之时间、地点、人物、事件、情节
时间 date 显示当前时间 time cmd 显示 cmd的运行时间 地点 locate 根据文件名,迅速找到文件.基于系统构建的索引 find 根据各种规则找到文件,更强大,但比较慢 wherei ...
- grafana 4.0.2 + openfalcon query 1.4.3
转:http://blog.csdn.net/vbaspdelphi/article/details/53884282 grafana 4.0.2 加上官方app自带的openfalcon插件, 可以 ...
- array_diff函数的注意事项
array_diff — 计算数组的差集 说明: array array_diff ( array $array1 , array $array2 [, array $... ] ) 对比返回在 ar ...
- Pager分页
分页组件: /// <summary> /// 分页组件 /// </summary> public class PagerHelper { /// <summary&g ...
- 【转】hurry_liu 大神STM32移植contiki入门之一:系统介绍和开发环境搭建
前言: 由于项目的原因,需要在LPC1788(STM32 cortex-M3)上面跑contiki. 之前没有涉及到contiki,不知其为何物.不过这个不是难事,做IT的,每每遇到新事物,都不会处理 ...
- PostgreSQL 监控数据库活动
监控数据库活动 1. 标准Unix 工具 [root@mysqlhq ~]# ps auxww | grep ^postgrespostgres 12106 0.0 0.0 340060 15064 ...
- Oracle 监听莫名死掉
有一台oracle 10g的监听莫名死掉,进行查看 select * from v$version Oracle Database 10g Enterprise Edition Release 10. ...