結果

問題 No.2795 Perfect Number
ユーザー 2475057t
提出日時 2024-07-07 18:54:50
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 384 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 18:54:59
合計ジャッジ時間 8,285 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 RE * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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