結果

問題 No.648  お や す み 
ユーザー Freed_0929
提出日時 2018-02-10 00:45:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 2,223 ms
コンパイル使用メモリ 76,748 KB
実行使用メモリ 41,996 KB
最終ジャッジ日時 2024-09-13 21:06:45
合計ジャッジ時間 15,818 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        boolean c = true;
        long x=(long)Math.sqrt(2*N);
        if(x*(x+1)==2*N){
            System.out.println("YES\n" + x);
        } else {
            System.out.println("NO");
        }
    }
}
0