結果
問題 | No.2795 Perfect Number |
ユーザー |
|
提出日時 | 2024-06-28 21:48:24 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,077 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 82,408 KB |
実行使用メモリ | 67,984 KB |
最終ジャッジ日時 | 2024-06-28 21:48:29 |
合計ジャッジ時間 | 4,571 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
58,112 KB |
testcase_01 | AC | 38 ms
51,968 KB |
testcase_02 | AC | 34 ms
52,480 KB |
testcase_03 | AC | 33 ms
52,224 KB |
testcase_04 | AC | 34 ms
52,224 KB |
testcase_05 | AC | 35 ms
51,968 KB |
testcase_06 | AC | 35 ms
52,736 KB |
testcase_07 | AC | 34 ms
52,448 KB |
testcase_08 | AC | 31 ms
51,968 KB |
testcase_09 | AC | 31 ms
52,224 KB |
testcase_10 | AC | 32 ms
52,608 KB |
testcase_11 | AC | 31 ms
52,480 KB |
testcase_12 | AC | 36 ms
52,224 KB |
testcase_13 | AC | 31 ms
52,608 KB |
testcase_14 | AC | 33 ms
52,352 KB |
testcase_15 | AC | 33 ms
52,224 KB |
testcase_16 | AC | 33 ms
52,096 KB |
testcase_17 | AC | 33 ms
52,224 KB |
testcase_18 | AC | 32 ms
52,480 KB |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
ソースコード
N = int(input()) def factorize(K): ret = 1 i=2 cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) i=3 cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) i=5 cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) i=7 cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) i=11 cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) while K!=1: if i%3 ==0 or i%5 == 0 or i%7 == 0: i+=2 continue if i>=int(K**0.5)+1: break cnt=0 while K%i==0: K//=i cnt+=1 if cnt!=0: ret *= (pow(i,cnt+1)-1)//(i-1) i += 2 if K!=1: ret *= (1+K) return ret r = factorize(N) if r == N*2: print("Yes") else: print("No") #print(r)