結果

問題 No.648  お や す み 
ユーザー Freed_0929Freed_0929
提出日時 2018-02-10 00:04:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 2,644 ms
コンパイル使用メモリ 76,924 KB
実行使用メモリ 42,176 KB
最終ジャッジ日時 2024-04-17 12:48:03
合計ジャッジ時間 15,424 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
41,760 KB
testcase_01 AC 131 ms
41,420 KB
testcase_02 AC 146 ms
41,784 KB
testcase_03 AC 130 ms
41,188 KB
testcase_04 AC 132 ms
41,676 KB
testcase_05 AC 145 ms
41,528 KB
testcase_06 AC 119 ms
39,848 KB
testcase_07 AC 119 ms
40,320 KB
testcase_08 AC 130 ms
41,472 KB
testcase_09 AC 145 ms
41,640 KB
testcase_10 AC 130 ms
41,448 KB
testcase_11 AC 120 ms
40,580 KB
testcase_12 AC 129 ms
41,200 KB
testcase_13 AC 129 ms
41,288 KB
testcase_14 AC 119 ms
40,100 KB
testcase_15 AC 119 ms
40,252 KB
testcase_16 AC 131 ms
41,784 KB
testcase_17 AC 131 ms
41,416 KB
testcase_18 AC 129 ms
41,512 KB
testcase_19 AC 130 ms
41,212 KB
testcase_20 AC 145 ms
41,696 KB
testcase_21 AC 144 ms
41,740 KB
testcase_22 AC 146 ms
41,896 KB
testcase_23 AC 146 ms
41,680 KB
testcase_24 AC 135 ms
40,644 KB
testcase_25 AC 145 ms
41,640 KB
testcase_26 AC 144 ms
41,780 KB
testcase_27 AC 144 ms
41,888 KB
testcase_28 AC 135 ms
40,156 KB
testcase_29 AC 143 ms
41,708 KB
testcase_30 AC 130 ms
41,524 KB
testcase_31 AC 129 ms
41,408 KB
testcase_32 AC 116 ms
41,656 KB
testcase_33 AC 130 ms
41,428 KB
testcase_34 AC 131 ms
41,124 KB
testcase_35 AC 128 ms
41,404 KB
testcase_36 AC 132 ms
41,572 KB
testcase_37 AC 133 ms
41,608 KB
testcase_38 AC 131 ms
41,704 KB
testcase_39 AC 130 ms
41,684 KB
testcase_40 AC 132 ms
41,572 KB
testcase_41 AC 129 ms
41,192 KB
testcase_42 AC 131 ms
41,440 KB
testcase_43 AC 130 ms
41,328 KB
testcase_44 AC 129 ms
41,336 KB
testcase_45 AC 131 ms
41,656 KB
testcase_46 AC 128 ms
41,404 KB
testcase_47 AC 130 ms
41,148 KB
testcase_48 AC 130 ms
41,832 KB
testcase_49 AC 128 ms
41,528 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 129 ms
41,304 KB
testcase_61 AC 130 ms
41,396 KB
testcase_62 AC 128 ms
41,380 KB
testcase_63 AC 130 ms
41,576 KB
testcase_64 AC 130 ms
41,380 KB
testcase_65 AC 129 ms
41,668 KB
testcase_66 AC 130 ms
41,416 KB
testcase_67 AC 132 ms
41,672 KB
testcase_68 AC 130 ms
41,448 KB
testcase_69 AC 129 ms
41,384 KB
testcase_70 AC 131 ms
41,324 KB
testcase_71 AC 130 ms
41,256 KB
testcase_72 AC 130 ms
41,652 KB
testcase_73 AC 116 ms
41,376 KB
testcase_74 AC 128 ms
41,420 KB
testcase_75 AC 131 ms
41,396 KB
testcase_76 AC 131 ms
41,548 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 144 ms
42,176 KB
testcase_83 AC 146 ms
41,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long ch = 0;
        boolean c = true;
        if (N >= 2000000000) {
            c = false;
        } else {
            for (long i = 0;; i++) {
                ch += i;
                if (ch == N) {
                    ch = i;
                    break;
                } else if (ch > N) {
                    c = false;
                    break;
                }
            }
        }
        if (c == true) {
            System.out.println("YES\n" + ch);
        } else {
            System.out.println("NO");
        }
    }
}
0