結果

問題 No.3388 Sum of Function
コンテスト
ユーザー detteiuu
提出日時 2025-11-28 21:22:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 54,244 KB
最終ジャッジ日時 2025-11-28 21:22:28
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def isPrime(n):
    if n <= 1:
        return False
    else:
        i = 2
        while i**2 <= n:
            if n%i == 0:
                return False
            i += 1
        return True

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

def func(x):
    return x**3-x**2+x+1

ans = 0
for n in range(A, B+1):
    if isPrime(n):
        ans += func(n)

print(ans)
0