結果
問題 | No.648 お や す み |
ユーザー | uafr_cs |
提出日時 | 2018-02-09 22:33:54 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 2,353 bytes |
コンパイル時間 | 2,644 ms |
コンパイル使用メモリ | 83,020 KB |
実行使用メモリ | 37,492 KB |
最終ジャッジ日時 | 2024-09-13 20:45:56 |
合計ジャッジ時間 | 9,296 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
36,976 KB |
testcase_01 | AC | 55 ms
37,336 KB |
testcase_02 | AC | 53 ms
37,200 KB |
testcase_03 | AC | 54 ms
36,832 KB |
testcase_04 | AC | 55 ms
36,964 KB |
testcase_05 | AC | 54 ms
37,052 KB |
testcase_06 | AC | 55 ms
36,928 KB |
testcase_07 | AC | 55 ms
37,080 KB |
testcase_08 | AC | 54 ms
37,212 KB |
testcase_09 | AC | 55 ms
37,084 KB |
testcase_10 | AC | 54 ms
36,840 KB |
testcase_11 | AC | 54 ms
37,120 KB |
testcase_12 | AC | 54 ms
37,264 KB |
testcase_13 | AC | 55 ms
37,352 KB |
testcase_14 | AC | 54 ms
37,380 KB |
testcase_15 | AC | 54 ms
36,980 KB |
testcase_16 | AC | 54 ms
36,840 KB |
testcase_17 | AC | 55 ms
37,248 KB |
testcase_18 | AC | 54 ms
37,308 KB |
testcase_19 | AC | 55 ms
37,212 KB |
testcase_20 | AC | 56 ms
36,832 KB |
testcase_21 | AC | 54 ms
37,484 KB |
testcase_22 | AC | 55 ms
37,076 KB |
testcase_23 | AC | 55 ms
37,352 KB |
testcase_24 | AC | 55 ms
37,200 KB |
testcase_25 | AC | 54 ms
37,068 KB |
testcase_26 | AC | 54 ms
37,268 KB |
testcase_27 | AC | 53 ms
37,080 KB |
testcase_28 | AC | 54 ms
37,192 KB |
testcase_29 | AC | 54 ms
37,344 KB |
testcase_30 | AC | 55 ms
37,240 KB |
testcase_31 | AC | 53 ms
37,204 KB |
testcase_32 | AC | 55 ms
37,352 KB |
testcase_33 | AC | 55 ms
36,844 KB |
testcase_34 | AC | 54 ms
37,068 KB |
testcase_35 | AC | 55 ms
37,236 KB |
testcase_36 | AC | 54 ms
37,108 KB |
testcase_37 | AC | 54 ms
37,120 KB |
testcase_38 | AC | 54 ms
37,080 KB |
testcase_39 | AC | 56 ms
37,040 KB |
testcase_40 | AC | 55 ms
37,180 KB |
testcase_41 | AC | 53 ms
36,976 KB |
testcase_42 | AC | 53 ms
37,324 KB |
testcase_43 | AC | 55 ms
37,356 KB |
testcase_44 | AC | 55 ms
37,236 KB |
testcase_45 | AC | 55 ms
36,944 KB |
testcase_46 | AC | 55 ms
37,236 KB |
testcase_47 | AC | 55 ms
37,332 KB |
testcase_48 | AC | 54 ms
37,316 KB |
testcase_49 | AC | 54 ms
37,088 KB |
testcase_50 | AC | 54 ms
37,480 KB |
testcase_51 | AC | 53 ms
37,332 KB |
testcase_52 | AC | 55 ms
36,852 KB |
testcase_53 | AC | 54 ms
37,300 KB |
testcase_54 | AC | 55 ms
37,084 KB |
testcase_55 | AC | 55 ms
37,236 KB |
testcase_56 | AC | 54 ms
37,492 KB |
testcase_57 | AC | 54 ms
36,844 KB |
testcase_58 | AC | 54 ms
36,972 KB |
testcase_59 | AC | 57 ms
37,072 KB |
testcase_60 | AC | 53 ms
36,972 KB |
testcase_61 | AC | 54 ms
37,200 KB |
testcase_62 | AC | 53 ms
37,276 KB |
testcase_63 | AC | 54 ms
36,956 KB |
testcase_64 | AC | 54 ms
37,344 KB |
testcase_65 | AC | 56 ms
37,264 KB |
testcase_66 | AC | 55 ms
37,240 KB |
testcase_67 | AC | 53 ms
36,956 KB |
testcase_68 | AC | 54 ms
36,848 KB |
testcase_69 | AC | 54 ms
37,360 KB |
testcase_70 | AC | 55 ms
37,088 KB |
testcase_71 | AC | 53 ms
37,120 KB |
testcase_72 | AC | 55 ms
37,216 KB |
testcase_73 | AC | 53 ms
37,324 KB |
testcase_74 | AC | 54 ms
37,092 KB |
testcase_75 | AC | 54 ms
37,312 KB |
testcase_76 | AC | 53 ms
37,240 KB |
testcase_77 | AC | 53 ms
37,048 KB |
testcase_78 | AC | 54 ms
37,176 KB |
testcase_79 | AC | 54 ms
37,260 KB |
testcase_80 | AC | 54 ms
37,304 KB |
testcase_81 | AC | 55 ms
37,456 KB |
testcase_82 | AC | 55 ms
37,056 KB |
testcase_83 | AC | 54 ms
37,324 KB |
ソースコード
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.ListIterator; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void main(String[] args) throws IOException { try (Scanner sc = new Scanner(System.in)) { final long N = sc.nextLong(); final long sqrt = (long)(Math.sqrt(2 * N)); //System.out.println(sqrt + " " + (sqrt * (sqrt + 1) / 2)); if((sqrt) * (sqrt + 1) / 2 == N){ System.out.println("YES"); System.out.println(sqrt); return; } if((sqrt + 1) * (sqrt + 2) / 2 == N){ System.out.println("YES"); System.out.println(sqrt + 1); return; } System.out.println("NO"); } } public static class Scanner implements Closeable { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() throws IOException { while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() throws IOException { getLine(); return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public int[] nextIntArray(int n) throws IOException { final int[] ret = new int[n]; for (int i = 0; i < n; i++) { ret[i] = this.nextInt(); } return ret; } public long[] nextLongArray(int n) throws IOException { final long[] ret = new long[n]; for (int i = 0; i < n; i++) { ret[i] = this.nextLong(); } return ret; } public void close() throws IOException { br.close(); } } }