結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-25 16:10:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,277 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 389,000 KB
最終ジャッジ日時 2023-11-25 16:10:42
合計ジャッジ時間 14,986 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,612 KB
testcase_01 AC 45 ms
55,612 KB
testcase_02 AC 45 ms
55,612 KB
testcase_03 AC 155 ms
98,888 KB
testcase_04 AC 46 ms
55,612 KB
testcase_05 TLE -
testcase_06 AC 717 ms
198,872 KB
testcase_07 AC 46 ms
55,612 KB
testcase_08 AC 46 ms
55,612 KB
testcase_09 AC 46 ms
55,612 KB
testcase_10 AC 49 ms
61,576 KB
testcase_11 AC 46 ms
55,612 KB
testcase_12 AC 60 ms
68,020 KB
testcase_13 AC 55 ms
64,328 KB
testcase_14 AC 61 ms
67,788 KB
testcase_15 AC 51 ms
61,576 KB
testcase_16 AC 55 ms
64,204 KB
testcase_17 AC 53 ms
63,688 KB
testcase_18 AC 52 ms
63,688 KB
testcase_19 AC 165 ms
99,844 KB
testcase_20 AC 418 ms
146,592 KB
testcase_21 AC 197 ms
106,988 KB
testcase_22 AC 179 ms
101,368 KB
testcase_23 AC 287 ms
121,300 KB
testcase_24 AC 406 ms
146,336 KB
testcase_25 AC 687 ms
193,472 KB
testcase_26 AC 640 ms
193,216 KB
testcase_27 AC 109 ms
89,300 KB
testcase_28 AC 334 ms
126,664 KB
testcase_29 AC 615 ms
189,460 KB
testcase_30 AC 118 ms
92,980 KB
testcase_31 AC 546 ms
169,480 KB
testcase_32 AC 628 ms
191,348 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N,L = map(int,input().split())

class prime_factorize():
    
    def __init__(self,M=10**6):
        self.sieve = [-1]*(M+1)
        self.sieve[1] = 1
        self.p = [False]*(M+1)
        self.mu = [1]*(M+1)
        
        for i in range(2,M+1):
            if self.sieve[i] == -1:
                self.p[i] = True
                
                i2 = i**2
                for j in range(i2,M+1,i2):
                    
                    self.mu[j] = 0
                
                
                for j in range(i,M+1,i):
                    self.sieve[j] = i
                    
                    self.mu[j] *= -1
                    
    def factors(self,x):
        tmp = []
        while self.sieve[x] != x:
            tmp.append(self.sieve[x])
            x //= self.sieve[x]
        tmp.append(self.sieve[x])
        return tmp
        
    def is_prime(self,x):
        return self.p[x]
        
    def mobius(self,x):
        return self.mu[x]
        
pf = prime_factorize(L)

ans = 0
for d in range(2,(L+1 + N-2)//(N-1)+1):
    
    if pf.is_prime(d):
        
        ans += max(0,L - (N-1)*d + 1)
print(ans)
0