codeforces 432 B Football Kit】的更多相关文章

题意:给出n支球队,主场的衣服的颜色x[i],客场的衣服的颜色y[i],每只队伍会打n-1次主场,n-1次客场,当这只队伍打客场的衣服颜色和对手一样的时候,那么他们要穿上主场的衣服 问每个球队主场球服和客场球服分别穿了多少次 主场分两部分 1.本来n-1场穿的 2.打客场的时候和对手一样穿上主场的衣服 所以统计一下主场的每种颜色对应的衣服有多少件 那么对应于一只球队(x[i],y[i]) 就是n-1+home[y[i]],n-1-home[y[i]] 题意好绕的说啊-----5555555555…
 Football Kit Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 432B Description Consider a football tournament where n teams participate. Each team has two football kits: for home games,…
B. Football Kit time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games…
题目的意思是求出每个队穿主场衣服和客场衣服的次数 每个队作为主场的次数是n-1,作为客场的次数是n-1 当每个队打主场的时候肯定穿的主场衣服 当每个队打客场时,如果客场与主场的衣服不同,则穿客场衣服   如果客场与主场的衣服相同,则穿主场衣服 则只需要标记主场每种衣服有多少球队,当作为客场时查找与客场颜色相同的主场球队有多少即可 #include <iostream> #include <map> #include <vector> #include <algor…
#432 Div2 D 题意 给出一些数字,如果这些数字的的 \(gcd\) 不为1则称这些数字 \(good\). 可以有两种操作: 花费 x 删掉一个数 花费 y 将一个数加 1 问使这些数 \(good\) 的最小花费. 分析 一直找不到这题的重点.其实仔细想想与 \(gcd\) 有关,或者说与一个数列所有数的 \(gcd\) 有关,应该考虑到枚举所有的因子(或素因子),枚举因子对于求一系列数的 \(gcd\) 时貌似是很常见的. 对于本题,考虑枚举所有的素因子,设某个素因子为 \(p\)…
解题思路: 暴力绝对TLE 一个队伍穿主场球衣的次数 = 这个队伍的客场球衣颜色与其他队主场球衣颜色起冲突的次数 + (n - 1) #include <stdio.h> #include <string.h> #include <iostream> using namespace std; ; const int INF = 0x3f3f3f3f; ], b[], c[], cnt[]; int main(){ int t, i, j, m, n; memset(c,…
用扩展KMP做简单省力..... D. Prefixes and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character.…
hash做法: #include<stdio.h> #include<string.h> ; int home[Max],away[Max],hash[Max]; int main() { int n,sum,total; int i,j; while(scanf("%d",&n)!=EOF) { sum = ; total = *(n-); ;i<n;i++) scanf("%d %d",&home[i],&a…
思维加枚举 题意 :足球赛,赢平所得到的分数分别为w和d,w>d,分别求赢平输的场数,输出一组即可,即x+y+z=n 且 xw+yd=p的一组解. 可以扩展公约数做,但由于注意到d和w<1e5的条件,可以枚举. 个人理解是由于dw=wd 就是说你用w场平的所得分和d场赢所得分是一样,所以我们就可以调整平的场数,由于题目有这样一句话 Note that w>dw>d, so the number of points awarded for winning is strictly gr…
题目例如以下: B. Football Kit time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for aw…