結果
問題 |
No.2795 Perfect Number
|
ユーザー |
|
提出日時 | 2024-06-28 21:27:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,955 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 18,720 KB |
最終ジャッジ日時 | 2024-06-28 21:27:14 |
合計ジャッジ時間 | 3,797 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 2 TLE * 1 -- * 32 |
ソースコード
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 'NO' def run(W): res = 'YES' 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()