結果

問題 No.648  お や す み 
ユーザー tnk_s
提出日時 2018-09-13 10:41:04
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 04:21:37
合計ジャッジ時間 2,038 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 = (int)x;
        y = y - 1;
        
        if (y % 2 == 0)
        {
            int i = y / 2;
            printf("YES\n%d\n", &i);
            b = 1;
        }
    }
    
    if (b == 0)
    {
        printf("NO\n");
    }

    return 0;
}
0