結果

問題 No.648  お や す み 
ユーザー keiden
提出日時 2024-09-20 19:10:26
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 30,464 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-20 19:10:31
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(void) {
    uint64_t n;
    scanf("%" PRIu64, &n);
    uint64_t k = sqrtl(2 * n);
    if (k * (k + 1) / 2 == n) {
        printf("YES\n%" PRIu64 "\n", k);
    }
    else {
        printf("NO\n");
    }
    return 0;
}
0