結果
問題 |
No.2043 Ohuton and Makura
|
ユーザー |
![]() |
提出日時 | 2022-08-19 21:49:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 1,076 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 64,000 KB |
最終ジャッジ日時 | 2024-10-08 08:14:26 |
合計ジャッジ時間 | 2,426 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
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)