結果

問題 No.2795 Perfect Number
ユーザー _a_a
提出日時 2024-06-28 21:27:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,935 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,592 KB
最終ジャッジ日時 2024-06-28 21:27:54
合計ジャッジ時間 3,980 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
17,280 KB
testcase_01 AC 39 ms
11,776 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import os, sys
import math, decimal, queue, heapq, bisect, itertools, functools, collections, string
from bisect import bisect, bisect_left
from collections import defaultdict, OrderedDict, deque, Counter
from functools import cmp_to_key, lru_cache, reduce
from heapq import heapify, heappush, heappushpop, heappop, heapreplace, nlargest, nsmallest
from itertools import accumulate, chain, combinations, combinations_with_replacement, compress, count, cycle, dropwhile, filterfalse, groupby, islice, permutations, product, repeat, starmap, takewhile, tee, zip_longest
from math import gcd, factorial, isqrt, comb, perm, prod, inf
from queue import Queue, PriorityQueue, LifoQueue
from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, hexdigits, octdigits

az, AZ, mod = ascii_lowercase, ascii_uppercase, 1_000_000_007


def solve():

    def _f(n):
        divs = set()
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divs.add(i)
                divs.add(n // i)
        res = 0
        for num in sorted(divs):
            # if num % 2 == 0:
            res += num
        if res == 2 * n:
            return 'Yes'
        else:
            return 'N0'

    def run(W):
        x = W[0]
        return _f(x)
    print(run(W))


if __name__ == '__main__':
    LOCAL = sys.argv[0] if '4a' in sys.argv[0] else None

    P = lambda *p: [print(i, end='  ') for i in p] if LOCAL else None
    PI = lambda *p: print(' '.join(map(str, p))) or None
    PII = lambda X: [PI(*row) for row in X]

    sys.stdin = open(os.path.join(os.getcwd(), 'a1.txt'), 'r') if LOCAL else sys.stdin
    I = lambda: [int(a) for l in sys.stdin for a in l.strip().split()]
    S = lambda: [a for l in sys.stdin for a in l.strip().split()]
    IM = lambda: [[int(a) for a in l.split()] for l in sys.stdin]
    SM = lambda: [[a for a in l.split()] for l in sys.stdin]
    W = I()
    # P(W)
    solve()
0