C - The Football Season 先考虑求解 \[ x\times w + y\times d=p \] 若存在一组解 \[ \begin{cases} x_0\\ y_0 = kw + v & (0<v<w)\\ \end{cases} \] 则 \[ x_0 \times w + y_0 \times d = p\\ \Rightarrow x_0 \times w + (kw+v)\times d = p\\ \Rightarrow x_0\times w + k\…
思维加枚举 题意 :足球赛,赢平所得到的分数分别为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…
American Football Vocabulary! Share Tweet Share You’ll learn all about the vocabulary of American football in this video. I’ll teach you how to understand the basic rules of the game, show you how to pronounce the key American football terms and hel…
The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets …
A. Pens and Pencils 题目链接:https://codeforces.com/contest/1244/problem/A 题意: 给定五个数 a , b , c , d , k 求一对 x , y 使得 cx >= a , dy >= b , 且 x + y <= k 若无法找到满足条件的 x , y ,则输出 - 1 分析: 判断 a 是否能除尽 c , 如果能 , 则 x 最小可以为 c / a , 否则 x 最小可以为 a / c + 1 再判断 b 是否能除尽…
codeforces #592(Div.2) A Pens and Pencils Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for th…
The following code is my submission for Codeforces 1244C The Football Season. import io import sys import math def inverse(a, m): u = 0 v = 1 while a != 0: t = m // a m -= t * a a, m = m, a u -= t * v u, v = v, u assert m == 1 return u def main(): #…
Problem - A Tomorrow is a difficult day for Polycarp: he has to attend \(a\) lectures and \(b\) practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for the university, Polycarp…