結果

問題 No.2795 Perfect Number
ユーザー 6soukiti29
提出日時 2024-07-09 01:21:26
言語 Nim
(2.2.0)
結果
TLE  
実行時間 -
コード長 264 bytes
コンパイル時間 3,375 ms
コンパイル使用メモリ 65,668 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-07-09 01:21:33
合計ジャッジ時間 7,400 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
/home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,algorithm,math


var
    N = stdin.readline.parseInt
    a = 0
    i = 1
while i * i <= N:
    if N mod i == 0:
        a += i
        if i * i != N:
            a += N div i
    i += 1

if a == 2 * N:
    echo("Yes")
else:
    echo("No")
0