結果

問題 No.2043 Ohuton and Makura
ユーザー neterukunneterukun
提出日時 2022-08-19 21:49:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 1,076 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 64,768 KB
最終ジャッジ日時 2024-04-17 00:30:32
合計ジャッジ時間 1,776 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,608 KB
testcase_01 AC 37 ms
52,352 KB
testcase_02 AC 44 ms
60,672 KB
testcase_03 AC 41 ms
60,416 KB
testcase_04 AC 50 ms
60,288 KB
testcase_05 AC 50 ms
60,800 KB
testcase_06 AC 44 ms
60,288 KB
testcase_07 AC 55 ms
60,544 KB
testcase_08 AC 44 ms
60,160 KB
testcase_09 AC 46 ms
60,416 KB
testcase_10 AC 50 ms
60,672 KB
testcase_11 AC 52 ms
61,056 KB
testcase_12 AC 36 ms
52,736 KB
testcase_13 AC 35 ms
51,968 KB
testcase_14 AC 36 ms
51,840 KB
testcase_15 AC 46 ms
58,112 KB
testcase_16 AC 45 ms
58,112 KB
testcase_17 AC 60 ms
64,768 KB
testcase_18 AC 35 ms
52,736 KB
testcase_19 AC 51 ms
60,672 KB
testcase_20 AC 51 ms
60,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Arithmetic:
    @staticmethod
    def get(a0, d, i):
        return i * a0 + d

    @staticmethod
    def general_term(i, ai, j, aj):
        def gcd(a, b):
            while b: a, b = b, a % b
            return a

        assert(i != j)
        if i > j:
            i, j = j, i
        gcd_ = gcd(abs(j * ai - i * aj), j - i)
        rational_a0 = ((j * ai - i * aj) // gcd_, (j - i) // gcd_)
        gcd_ = gcd(abs(aj - ai), j - i)
        rational_d = ((aj - ai) // gcd_, (j - i) // gcd_)
        return rational_a0, rational_d

    @staticmethod
    def sum(a0, d, r):
        return r * a0 + d * (r - 1) * r // 2

    @staticmethod
    def range_sum(a0, d, l, r):
        return Arithmetic.sum(a0, d, r) - Arithmetic.sum(a0, d, l)


a, b, s = map(int, input().split())


ans = 0
for x in range(1, a + 1):
    max_y = min(s // x, b)
    if max_y == 0:
        continue
    ptn_x = a - x + 1
    ptn_y = 0

    ptn_y = Arithmetic.range_sum(b + 1, -1, 1, max_y + 1)
    #for y in range(1, max_y + 1):
    #    ptn_y += b - y + 1
    ans += ptn_x * ptn_y


print(ans)
0