結果

問題 No.648  お や す み 
ユーザー Mcpu3
提出日時 2018-09-22 16:16:41
言語 Java
(openjdk 23)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 76,096 KB
実行使用メモリ 55,096 KB
最終ジャッジ日時 2024-07-18 08:59:52
合計ジャッジ時間 13,187 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong(),t;
        sc.close();
        t=(long)Math.sqrt(2*n);
        if(n==(t*(t+1))/2)System.out.print("YES\n"+t);
        else System.out.print("NO");
    }
}
0