結果

問題 No.406 鴨等間隔の法則
コンテスト
ユーザー ID 21712
提出日時 2024-10-27 21:09:05
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 662 ms / 2,000 ms
コード長 269 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 15,684 ms
コンパイル使用メモリ 278,900 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-05 23:29:46
合計ジャッジ時間 25,776 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import . "fmt"
import . "sort"

func main() {
	var n int
	Scan(&n)
	a:=make([]int,n)
	for i:=range a {
		Scan(&a[i])
	}
	Ints(a)
	x:=a[0]!=a[n-1]
	for i,v:=range a[1:] {
		x=x&&(a[1]-a[0]==v-a[i])
	}
	if x {
		Println("YES")
	} else {
		Println("NO")
	}
}
0