結果

問題 No.648  お や す み 
コンテスト
ユーザー tnk_s
提出日時 2018-09-13 10:35:58
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 450 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 162 ms
コンパイル使用メモリ 41,068 KB
最終ジャッジ日時 2026-02-22 01:45:17
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 53 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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", &i);
            b = 1;
        }
    }
    
    if (b == 0)
    {
        printf("NO");
    }

    return 0;
}
0