結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2019-08-05 16:07:43 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 12,322 ms |
コンパイル使用メモリ | 236,732 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 12:41:20 |
合計ジャッジ時間 | 14,411 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Scan() n, _ := strconv.Atoi(sc.Text()) a := make([]int, n) for i := range a { sc.Scan() a[i], _ = strconv.Atoi(sc.Text()) } sort.Ints(a) d := a[1] - a[0] for i := 0; i < n-1; i++ { if d != a[i+1]-a[i] || a[i] == a[i+1] { fmt.Println("NO") return } } fmt.Println("YES") }