結果

問題 No.2795 Perfect Number
ユーザー 2475057t
提出日時 2024-07-07 18:45:56
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 380 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 18:46:02
合計ジャッジ時間 3,799 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other AC * 13 WA * 2 RE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void)
{
    int N=0, sum=0, count=0;
    scanf("%d", &N);
    int a[N];
    for(int i=0; i<N; i++){
        if(N%i == 0){
            a[count] = i;
            count++;
        }
    }
    for(int i=0; i<count; i++){
        sum = sum + a[i];
    }
    if(sum == 2*N){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}
0