結果
問題 | No.1022 Power Equation |
ユーザー | hedwig100 |
提出日時 | 2020-04-11 16:09:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-19 03:58:35 |
合計ジャッジ時間 | 1,379 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from math import gcd def root_int(a,k): if k == 0: return 0 x = int(a ** (1 / k)) while (x ** k) > a: x -= 1 while ((x + 1) ** k) <= a: x += 1 return x def main(): t = int(input()) for _ in range(t): n = int(input()) ans = n * n for b in range(1,35): for d in range(1,35): if gcd(b,d) != 1: continue lim1 = max(root_int(n,max(b,d)),1) - 1 lim2 = n//max(b,d) ans += lim1 * lim2 print(ans) if __name__ =='__main__': main()