[PYTHON] yukicoder contest 267 entry record

yukicoder contest 267 entry record

A 1236 long hand and short hand

The long hand and the short hand meet 11 times in 12 hours. Naturally, the number of seconds of 12 hours is divided by 11 and the number of seconds is calculated as the number of seconds next to the current time. The difference is the answer.

from bisect import bisect_left

A, B = map(int, input().split())

x = [i * 12 * 60 * 60 // 11 for i in range(12)]
t = (A * 60 + B) % (12 * 60) * 60
print(x[bisect_left(x, t)] - t)

B 1237 EXP Multiple!

If you read it carefully, it's not "the remainder of dividing the answer by 10 9 </ sup> + 7", but "the remainder of dividing the answer by 10 9 </ sup> + 7" orz. Then it's easy to solve. Many people got caught up in this because of the number of people who solved it (laughs).

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


N, *A = map(int, open(0).read().split())

A.sort()

if A[0] == 0:
    print(-1)
    exit()

if A[-1] >= 4:
    print(m)
    exit()

fac = make_factorial_table(3)

t = 1
for a in A:
    t *= pow(a, fac[a])
    if t > m:
        break
print(m % t)

C 1238 Selection Class

Around the time I drew K, I thought, "Oh, I've solved a similar problem in the past," but I couldn't solve it. [ABC044C --Takahashi-kun and Card](https://atcoder.jp/contests/ It's almost the same as abc044 / tasks / arc060_a) (the difference between the average being just X and the average being X or more).

If a i </ sub> = A i </ sub> -K, then the question is how many ways to choose the total of a i </ sub> to be 0 or more. You can easily find it by doing DP.

m = 1000000007

N, K, *A = map(int, open(0).read().split())

for i in range(N):
    A[i] -= K

dp = {}
dp[0] = 1
for a in A:
    for k in sorted(dp, reverse=True) if a >= 0 else sorted(dp):
        dp.setdefault(k + a, 0)
        dp[k + a] += dp[k]

dp[0] -= 1
print(sum(dp[k] for k in dp if k >= 0) % m)

Recommended Posts

yukicoder contest 256 entry record
yukicoder contest 267 entry record
yukicoder contest 264 entry record
yukicoder contest 245 entry record
yukicoder contest 250 entry record
yukicoder contest 262 entry record
yukicoder contest 265 Participation record
yukicoder contest 266 Participation record
yukicoder contest 263 Participation record
yukicoder contest 243 Participation record
yukicoder contest 273 Participation record
yukicoder contest 252 Participation record
yukicoder contest 259 Participation record
yukicoder contest 249 Participation record
yukicoder contest 271 Participation record
yukicoder contest 251 Participation record
yukicoder contest 242 Participation record
yukicoder contest 241 Participation record
yukicoder contest 277 Participation record
yukicoder contest 257 Participation record
yukicoder contest 254 Participation record
yukicoder contest 246 Participation record
yukicoder contest 275 Participation record
yukicoder contest 274 Participation record
yukicoder contest 247 Participation record
yukicoder contest 261 Participation record
yukicoder contest 278 Participation record
yukicoder contest 248 Participation record
yukicoder contest 270 (mathematics contest) Participation record
yukicoder contest 272 (Weird math contest) Participation record
yukicoder contest 259 Review
yukicoder contest 264 Review
yukicoder contest 261 Review
yukicoder contest 267 Review
yukicoder contest 266 Review
yukicoder contest 263 Review
yukicoder contest 268 Review
AtCoder Beginner Contest 175 Virtual entry