結果

問題 No.648  お や す み 
ユーザー tnk_s
提出日時 2018-09-13 10:32:23
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 04:20:59
合計ジャッジ時間 2,067 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 53 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[]){
    int n;
    int b = 0;

    scanf("%d", &n);

    double x = sqrt( 1 + 8 * n );
    
    if (ceil(x) == floor(x)) 
    {
        int y = ceil(x);
        y = y - 1;
        
        if (y % 2 == 0)
        {
            int i = y / 2;
            printf("YES\n%d", &i);
            b = 1;
        }
    }
    
    if (b == 0)
    {
        printf("NO");
    }

    return 0;
}
0