AtCoder Regular Contest 113 - AtCoder 3 questions
- If A, B, and C all move in a range of 210**5, 810**15 will not make it in time.
- But when A is 2, B moves only half the range, and once A and B are determined, the range of C is determined by calculation. py
def main():
K = int(input())
ret = 0
for A in range(1, K + 1):
maxB = K // A
for B in range(1, maxB + 1):
maxC = maxB // B
ret += maxC
print(ret)
py
def main():
A, B, C = map(int, input().split())
doubling = [B % 20]
for i in range(32):
doubling.append(
(doubling[-1] ** 2) % 20
)
BC = 1
for i in range(32):
if C % 2:
BC *= doubling[i]
BC %= 20
C //= 2
if BC == 0:
BC = 20
ret = (A % 10) ** BC
ret %= 10
print(ret)
py
def main():
S = input().strip().decode('ascii')
from collections import defaultdict
count = defaultdict(int)
ret = 0
prev = None
count[S[-1]] += 1
count[S[-2]] += 1
for i in reversed(range(len(S) - 2)):
if S[i] != prev and S[i] == S[i + 1] != S[i + 2]:
d = (len(S) - 2) - i
d -= count[S[i]] - 1 # except S[i + 1]
ret += d
count = defaultdict(int)
p = len(S) - i
count[S[i]] = p
prev = S[i]
else:
count[S[i]] += 1
prev = None
print(ret)
This page is auto-translated from /nishio/ARC113 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.