結果

問題 No.406 鴨等間隔の法則
ユーザー nukosukenukosuke
提出日時 2016-10-20 14:16:11
言語 Raku
(rakudo v2024.02)
結果
AC  
実行時間 806 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 139,984 KB
実行使用メモリ 177,136 KB
最終ジャッジ日時 2024-05-03 13:26:15
合計ジャッジ時間 20,492 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 544 ms
149,252 KB
testcase_01 AC 411 ms
142,960 KB
testcase_02 AC 400 ms
143,340 KB
testcase_03 AC 391 ms
142,984 KB
testcase_04 AC 674 ms
162,248 KB
testcase_05 AC 516 ms
148,580 KB
testcase_06 AC 514 ms
148,452 KB
testcase_07 AC 535 ms
148,848 KB
testcase_08 AC 676 ms
162,304 KB
testcase_09 AC 715 ms
166,656 KB
testcase_10 AC 527 ms
149,380 KB
testcase_11 AC 636 ms
158,956 KB
testcase_12 AC 566 ms
151,904 KB
testcase_13 AC 567 ms
150,444 KB
testcase_14 AC 699 ms
162,560 KB
testcase_15 AC 430 ms
145,000 KB
testcase_16 AC 439 ms
144,740 KB
testcase_17 AC 430 ms
145,548 KB
testcase_18 AC 437 ms
145,548 KB
testcase_19 AC 516 ms
144,856 KB
testcase_20 AC 464 ms
145,176 KB
testcase_21 AC 435 ms
145,928 KB
testcase_22 AC 516 ms
147,860 KB
testcase_23 AC 584 ms
152,408 KB
testcase_24 AC 671 ms
159,428 KB
testcase_25 AC 716 ms
165,248 KB
testcase_26 AC 806 ms
177,136 KB
testcase_27 AC 652 ms
165,400 KB
testcase_28 AC 651 ms
165,228 KB
testcase_29 AC 805 ms
176,500 KB
testcase_30 AC 798 ms
176,428 KB
testcase_31 AC 729 ms
162,876 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

get();
my @x = get().split(' ').map({.Int}).sort({ $^a <=> $^b });
my $diff = @x[1] - @x[0];
my $expect = @x[1];
my $ans  = True;

if $diff == 0 {
  $ans = False;
}
else {
  for 1..@x.end {
    if $expect != @x[$_] {
      $ans = False;
      last;
    }
    $expect += $diff;
  }
}

say($ans ?? 'YES' !! 'NO');
0