結果
問題 | No.406 鴨等間隔の法則 |
ユーザー | Grenache |
提出日時 | 2016-08-05 22:27:01 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 365 ms / 2,000 ms |
コード長 | 1,795 bytes |
コンパイル時間 | 3,802 ms |
コンパイル使用メモリ | 75,544 KB |
実行使用メモリ | 62,572 KB |
最終ジャッジ日時 | 2023-09-21 17:41:02 |
合計ジャッジ時間 | 13,621 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 276 ms
59,048 KB |
testcase_01 | AC | 55 ms
50,456 KB |
testcase_02 | AC | 55 ms
48,648 KB |
testcase_03 | AC | 57 ms
50,308 KB |
testcase_04 | AC | 354 ms
62,008 KB |
testcase_05 | AC | 263 ms
57,124 KB |
testcase_06 | AC | 270 ms
59,540 KB |
testcase_07 | AC | 263 ms
59,432 KB |
testcase_08 | AC | 350 ms
60,000 KB |
testcase_09 | AC | 361 ms
62,572 KB |
testcase_10 | AC | 270 ms
59,224 KB |
testcase_11 | AC | 343 ms
61,756 KB |
testcase_12 | AC | 307 ms
59,556 KB |
testcase_13 | AC | 290 ms
57,140 KB |
testcase_14 | AC | 350 ms
61,872 KB |
testcase_15 | AC | 113 ms
54,648 KB |
testcase_16 | AC | 122 ms
54,924 KB |
testcase_17 | AC | 106 ms
54,604 KB |
testcase_18 | AC | 126 ms
54,164 KB |
testcase_19 | AC | 137 ms
54,304 KB |
testcase_20 | AC | 175 ms
55,256 KB |
testcase_21 | AC | 176 ms
55,128 KB |
testcase_22 | AC | 226 ms
56,952 KB |
testcase_23 | AC | 312 ms
57,696 KB |
testcase_24 | AC | 353 ms
61,876 KB |
testcase_25 | AC | 358 ms
62,316 KB |
testcase_26 | AC | 364 ms
61,920 KB |
testcase_27 | AC | 323 ms
61,608 KB |
testcase_28 | AC | 309 ms
61,744 KB |
testcase_29 | AC | 365 ms
62,344 KB |
testcase_30 | AC | 364 ms
62,096 KB |
testcase_31 | AC | 364 ms
62,504 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder406 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); } Arrays.sort(x); int diff = x[1] - x[0]; for (int i = 1; i < n; i++) { if (x[i] - x[i - 1] != diff) { pr.println("NO"); pr.close(); sc.close(); return; } } if (diff == 0) { pr.println("NO"); } else { pr.println("YES"); } pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator<String> it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { // it = Arrays.asList(br.readLine().split(" ")).iterator(); it = Arrays.asList(br.readLine().split("\\p{javaWhitespace}+")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }