結果
問題 | No.648 お や す み |
ユーザー | k_6101 |
提出日時 | 2019-12-14 01:17:59 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 133 ms / 2,000 ms |
コード長 | 1,533 bytes |
コンパイル時間 | 2,604 ms |
コンパイル使用メモリ | 87,680 KB |
実行使用メモリ | 41,504 KB |
最終ジャッジ日時 | 2024-06-28 00:19:51 |
合計ジャッジ時間 | 14,962 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
40,032 KB |
testcase_01 | AC | 125 ms
40,884 KB |
testcase_02 | AC | 124 ms
41,032 KB |
testcase_03 | AC | 125 ms
41,240 KB |
testcase_04 | AC | 123 ms
41,052 KB |
testcase_05 | AC | 109 ms
39,960 KB |
testcase_06 | AC | 120 ms
41,200 KB |
testcase_07 | AC | 109 ms
39,996 KB |
testcase_08 | AC | 109 ms
39,860 KB |
testcase_09 | AC | 124 ms
41,244 KB |
testcase_10 | AC | 132 ms
40,944 KB |
testcase_11 | AC | 126 ms
40,952 KB |
testcase_12 | AC | 110 ms
39,976 KB |
testcase_13 | AC | 123 ms
41,156 KB |
testcase_14 | AC | 121 ms
41,020 KB |
testcase_15 | AC | 132 ms
41,504 KB |
testcase_16 | AC | 127 ms
41,476 KB |
testcase_17 | AC | 122 ms
41,088 KB |
testcase_18 | AC | 112 ms
40,180 KB |
testcase_19 | AC | 122 ms
41,208 KB |
testcase_20 | AC | 123 ms
41,036 KB |
testcase_21 | AC | 126 ms
40,988 KB |
testcase_22 | AC | 131 ms
41,096 KB |
testcase_23 | AC | 121 ms
41,276 KB |
testcase_24 | AC | 124 ms
40,972 KB |
testcase_25 | AC | 118 ms
40,112 KB |
testcase_26 | AC | 121 ms
40,932 KB |
testcase_27 | AC | 121 ms
41,368 KB |
testcase_28 | AC | 122 ms
41,132 KB |
testcase_29 | AC | 122 ms
41,184 KB |
testcase_30 | AC | 110 ms
40,104 KB |
testcase_31 | AC | 125 ms
40,876 KB |
testcase_32 | AC | 129 ms
41,188 KB |
testcase_33 | AC | 132 ms
41,068 KB |
testcase_34 | AC | 130 ms
41,340 KB |
testcase_35 | AC | 122 ms
41,208 KB |
testcase_36 | AC | 120 ms
41,160 KB |
testcase_37 | AC | 119 ms
41,484 KB |
testcase_38 | AC | 123 ms
41,352 KB |
testcase_39 | AC | 124 ms
41,040 KB |
testcase_40 | AC | 121 ms
41,148 KB |
testcase_41 | AC | 118 ms
40,848 KB |
testcase_42 | AC | 120 ms
41,012 KB |
testcase_43 | AC | 120 ms
40,916 KB |
testcase_44 | AC | 121 ms
40,920 KB |
testcase_45 | AC | 133 ms
40,988 KB |
testcase_46 | AC | 131 ms
41,264 KB |
testcase_47 | AC | 123 ms
41,136 KB |
testcase_48 | AC | 126 ms
41,088 KB |
testcase_49 | AC | 125 ms
41,028 KB |
testcase_50 | AC | 132 ms
41,180 KB |
testcase_51 | AC | 120 ms
41,016 KB |
testcase_52 | AC | 108 ms
39,836 KB |
testcase_53 | AC | 123 ms
40,988 KB |
testcase_54 | AC | 122 ms
41,308 KB |
testcase_55 | AC | 121 ms
41,356 KB |
testcase_56 | AC | 121 ms
40,996 KB |
testcase_57 | AC | 123 ms
41,088 KB |
testcase_58 | AC | 112 ms
39,820 KB |
testcase_59 | AC | 127 ms
40,892 KB |
testcase_60 | AC | 123 ms
41,312 KB |
testcase_61 | AC | 123 ms
41,224 KB |
testcase_62 | AC | 117 ms
40,252 KB |
testcase_63 | AC | 124 ms
41,256 KB |
testcase_64 | AC | 122 ms
41,088 KB |
testcase_65 | AC | 120 ms
41,096 KB |
testcase_66 | AC | 122 ms
41,272 KB |
testcase_67 | AC | 110 ms
39,976 KB |
testcase_68 | AC | 124 ms
41,096 KB |
testcase_69 | AC | 125 ms
41,140 KB |
testcase_70 | AC | 123 ms
40,948 KB |
testcase_71 | AC | 120 ms
41,188 KB |
testcase_72 | AC | 120 ms
41,124 KB |
testcase_73 | AC | 120 ms
41,156 KB |
testcase_74 | AC | 123 ms
41,012 KB |
testcase_75 | AC | 125 ms
41,276 KB |
testcase_76 | AC | 123 ms
41,372 KB |
testcase_77 | AC | 131 ms
41,168 KB |
testcase_78 | AC | 112 ms
40,156 KB |
testcase_79 | AC | 109 ms
39,976 KB |
testcase_80 | AC | 123 ms
40,932 KB |
testcase_81 | AC | 124 ms
41,284 KB |
testcase_82 | AC | 126 ms
41,124 KB |
testcase_83 | AC | 123 ms
41,032 KB |
ソースコード
import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ================================================================== public void solve() { long N = Long.parseLong(sc.next()); long ng = 0, ok = 2000000000L; long md, wk; while(ng <= ok) { md = (ng + ok) / 2; wk = (md + 1) * md / 2; // out.println(" ng = " + ng + " ok = " + ok // + " md = " + md + " wk = " + wk); if(wk == N) { out.println("YES"); out.println(md); return; } else if(wk < N) { if(ng == md) break; ng = md; } else { if(ok == md) break; ok = md; } } out.println("NO"); } }