結果
問題 | No.648 お や す み |
ユーザー | silviasetitech |
提出日時 | 2020-03-15 16:19:39 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 1,267 bytes |
コンパイル時間 | 1,889 ms |
コンパイル使用メモリ | 75,048 KB |
実行使用メモリ | 56,368 KB |
最終ジャッジ日時 | 2024-05-03 22:27:54 |
合計ジャッジ時間 | 13,806 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 117 ms
54,216 KB |
testcase_01 | AC | 120 ms
54,192 KB |
testcase_02 | AC | 119 ms
54,252 KB |
testcase_03 | AC | 109 ms
53,240 KB |
testcase_04 | AC | 118 ms
54,216 KB |
testcase_05 | AC | 123 ms
54,472 KB |
testcase_06 | AC | 117 ms
54,128 KB |
testcase_07 | AC | 122 ms
54,300 KB |
testcase_08 | AC | 109 ms
53,068 KB |
testcase_09 | AC | 126 ms
54,004 KB |
testcase_10 | AC | 108 ms
53,036 KB |
testcase_11 | AC | 117 ms
56,368 KB |
testcase_12 | AC | 125 ms
54,360 KB |
testcase_13 | AC | 120 ms
54,580 KB |
testcase_14 | AC | 108 ms
53,048 KB |
testcase_15 | AC | 117 ms
54,272 KB |
testcase_16 | AC | 121 ms
54,388 KB |
testcase_17 | AC | 120 ms
54,384 KB |
testcase_18 | AC | 124 ms
54,088 KB |
testcase_19 | AC | 121 ms
54,116 KB |
testcase_20 | AC | 120 ms
54,104 KB |
testcase_21 | AC | 121 ms
54,264 KB |
testcase_22 | AC | 121 ms
54,320 KB |
testcase_23 | AC | 124 ms
54,072 KB |
testcase_24 | AC | 124 ms
53,876 KB |
testcase_25 | AC | 115 ms
54,016 KB |
testcase_26 | AC | 108 ms
53,192 KB |
testcase_27 | AC | 120 ms
54,316 KB |
testcase_28 | AC | 110 ms
53,088 KB |
testcase_29 | AC | 106 ms
53,032 KB |
testcase_30 | AC | 122 ms
54,200 KB |
testcase_31 | AC | 107 ms
52,860 KB |
testcase_32 | AC | 116 ms
53,568 KB |
testcase_33 | AC | 121 ms
54,136 KB |
testcase_34 | AC | 121 ms
54,136 KB |
testcase_35 | AC | 122 ms
54,500 KB |
testcase_36 | AC | 108 ms
52,824 KB |
testcase_37 | AC | 121 ms
54,044 KB |
testcase_38 | AC | 113 ms
52,844 KB |
testcase_39 | AC | 120 ms
54,236 KB |
testcase_40 | AC | 108 ms
52,956 KB |
testcase_41 | AC | 121 ms
54,168 KB |
testcase_42 | AC | 128 ms
54,184 KB |
testcase_43 | AC | 107 ms
53,120 KB |
testcase_44 | AC | 118 ms
54,032 KB |
testcase_45 | AC | 107 ms
53,084 KB |
testcase_46 | AC | 104 ms
52,860 KB |
testcase_47 | AC | 124 ms
54,304 KB |
testcase_48 | AC | 121 ms
54,420 KB |
testcase_49 | AC | 121 ms
54,584 KB |
testcase_50 | AC | 132 ms
54,116 KB |
testcase_51 | AC | 130 ms
54,228 KB |
testcase_52 | AC | 129 ms
54,136 KB |
testcase_53 | AC | 125 ms
53,968 KB |
testcase_54 | AC | 131 ms
54,292 KB |
testcase_55 | AC | 130 ms
54,384 KB |
testcase_56 | AC | 130 ms
54,268 KB |
testcase_57 | AC | 127 ms
54,228 KB |
testcase_58 | AC | 127 ms
54,272 KB |
testcase_59 | AC | 124 ms
54,056 KB |
testcase_60 | AC | 118 ms
54,140 KB |
testcase_61 | AC | 128 ms
54,148 KB |
testcase_62 | AC | 120 ms
54,752 KB |
testcase_63 | AC | 112 ms
53,328 KB |
testcase_64 | AC | 120 ms
54,256 KB |
testcase_65 | AC | 126 ms
54,236 KB |
testcase_66 | AC | 123 ms
54,348 KB |
testcase_67 | AC | 121 ms
54,268 KB |
testcase_68 | AC | 118 ms
54,348 KB |
testcase_69 | AC | 109 ms
53,108 KB |
testcase_70 | AC | 108 ms
53,104 KB |
testcase_71 | AC | 120 ms
54,344 KB |
testcase_72 | AC | 128 ms
54,384 KB |
testcase_73 | AC | 130 ms
54,388 KB |
testcase_74 | AC | 107 ms
53,240 KB |
testcase_75 | AC | 115 ms
53,388 KB |
testcase_76 | AC | 108 ms
53,136 KB |
testcase_77 | AC | 109 ms
53,556 KB |
testcase_78 | AC | 121 ms
53,996 KB |
testcase_79 | AC | 123 ms
54,084 KB |
testcase_80 | AC | 105 ms
52,852 KB |
testcase_81 | AC | 120 ms
54,324 KB |
testcase_82 | AC | 122 ms
54,484 KB |
testcase_83 | AC | 131 ms
54,276 KB |
ソースコード
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); sheepSleep solver = new sheepSleep(); solver.solve(1, in, out); out.close(); } static class sheepSleep { public void solve(int testNumber, Scanner in, PrintWriter out) { long n = in.nextLong(); long ng = -1; long ok = Integer.MAX_VALUE; while (Math.abs(ok - ng) > 1) { long mid = (ok + ng) / 2; if (mid * (mid + 1) / 2 >= n) { ok = mid; } else { ng = mid; } } if (ok * (ok + 1) / 2 == n) { out.println("YES"); out.println(ok); } else { out.println("NO"); } } } }