結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー ks2m
提出日時 2025-11-28 22:13:09
言語 Java
(openjdk 23)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 2,763 ms
コンパイル使用メモリ 80,464 KB
実行使用メモリ 46,752 KB
最終ジャッジ日時 2025-11-28 22:13:38
合計ジャッジ時間 8,340 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int s = a[0] + a[n - 1];
		for (int i = 0; i < n; i++) {
			if (a[i] + a[n - 1 - i] != s) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}
0