結果

問題 No.648  お や す み 
ユーザー Freed_0929Freed_0929
提出日時 2018-02-10 11:37:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 2,317 ms
コンパイル使用メモリ 76,836 KB
実行使用メモリ 56,136 KB
最終ジャッジ日時 2024-04-21 01:08:45
合計ジャッジ時間 17,332 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
54,436 KB
testcase_01 AC 142 ms
54,084 KB
testcase_02 AC 161 ms
54,172 KB
testcase_03 AC 144 ms
54,232 KB
testcase_04 AC 143 ms
53,984 KB
testcase_05 AC 160 ms
54,252 KB
testcase_06 AC 144 ms
54,020 KB
testcase_07 AC 145 ms
53,824 KB
testcase_08 AC 144 ms
54,028 KB
testcase_09 AC 161 ms
54,268 KB
testcase_10 AC 146 ms
54,292 KB
testcase_11 AC 143 ms
54,348 KB
testcase_12 AC 145 ms
54,164 KB
testcase_13 AC 144 ms
54,256 KB
testcase_14 AC 144 ms
54,452 KB
testcase_15 AC 142 ms
54,212 KB
testcase_16 AC 137 ms
54,200 KB
testcase_17 AC 141 ms
54,136 KB
testcase_18 AC 145 ms
54,132 KB
testcase_19 AC 142 ms
54,312 KB
testcase_20 AC 161 ms
54,260 KB
testcase_21 AC 159 ms
54,204 KB
testcase_22 AC 160 ms
54,024 KB
testcase_23 AC 161 ms
54,272 KB
testcase_24 AC 159 ms
54,492 KB
testcase_25 AC 162 ms
54,476 KB
testcase_26 AC 163 ms
54,508 KB
testcase_27 AC 161 ms
54,140 KB
testcase_28 AC 159 ms
54,112 KB
testcase_29 AC 156 ms
54,356 KB
testcase_30 AC 142 ms
54,052 KB
testcase_31 AC 141 ms
54,496 KB
testcase_32 AC 143 ms
53,944 KB
testcase_33 AC 147 ms
54,036 KB
testcase_34 AC 145 ms
54,244 KB
testcase_35 AC 148 ms
54,176 KB
testcase_36 AC 139 ms
54,052 KB
testcase_37 AC 145 ms
54,308 KB
testcase_38 AC 144 ms
54,136 KB
testcase_39 AC 147 ms
54,020 KB
testcase_40 AC 147 ms
54,320 KB
testcase_41 AC 145 ms
54,288 KB
testcase_42 AC 143 ms
54,016 KB
testcase_43 AC 147 ms
53,852 KB
testcase_44 AC 146 ms
54,128 KB
testcase_45 AC 144 ms
54,172 KB
testcase_46 AC 143 ms
54,340 KB
testcase_47 AC 148 ms
54,024 KB
testcase_48 AC 145 ms
54,260 KB
testcase_49 AC 141 ms
53,976 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 144 ms
54,204 KB
testcase_61 AC 148 ms
54,128 KB
testcase_62 AC 146 ms
54,088 KB
testcase_63 AC 148 ms
54,084 KB
testcase_64 AC 146 ms
54,284 KB
testcase_65 AC 145 ms
54,200 KB
testcase_66 AC 146 ms
53,980 KB
testcase_67 AC 144 ms
54,196 KB
testcase_68 AC 146 ms
53,844 KB
testcase_69 AC 147 ms
54,136 KB
testcase_70 AC 147 ms
54,044 KB
testcase_71 AC 147 ms
54,200 KB
testcase_72 AC 146 ms
54,244 KB
testcase_73 AC 146 ms
54,188 KB
testcase_74 AC 150 ms
54,356 KB
testcase_75 AC 147 ms
54,120 KB
testcase_76 AC 149 ms
54,244 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 161 ms
54,356 KB
testcase_83 AC 162 ms
54,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void nibutan(long n){
        long left=0;
        long right=n+1;
        long mid=0;
        while(left<right){
            mid=(right+left)/2;
            if(mid*(mid+1)==2*n){
            System.out.println("YES\n"+mid);
            return;
        }else if(mid*(mid+1)<2*n){
                left=mid+1;
            }else if(mid*(mid+1)>2*n){
                right=mid;
            }
        }
        System.out.println("NO");
}

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        nibutan(N);
    }
}
0