結果

問題 No.406 鴨等間隔の法則
ユーザー monburan_0401monburan_0401
提出日時 2018-09-15 16:57:23
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 976 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 28,172 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 08:39:38
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 0 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 12 ms
4,380 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 14 ms
4,376 KB
testcase_10 AC 6 ms
4,380 KB
testcase_11 AC 11 ms
4,376 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 6 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 8 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 13 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 13 ms
4,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 13 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int c(int*a,int*b){return *a - *b;}
int main(void){
	int N;
	int x[100000];
	int change;
    int d;
	
	scanf("%d",&N);
	for(int i = 0; i < N; i++){
		scanf("%d",&x[i]);
	}
	
	//	小さいものから順に並べる
/*	for(int j = 0; j < N-1; j++){
		for(int k = j; k < N; k++){
			if(x[j] > x[k]){
				change = x[j];
				x[j] = x[k];
				x[k] = change;
			}
		}
	}
*/
	// check ok
/*	for(int a = 0; a < N; a++){
		printf("%d ",x[a]);
	}
	printf("\n");
*/
	
/*	for(int l = N-1; l > 0; l--){
		x[l] -= x[l-1];
	}
*/
	
	// check ok
/*	for(int a = 0; a < N; a++){
		printf("%d ",x[a]);
	}
	printf("\n");
*/
    d = x[1] - x[0];
    for(int o = 2; o < N; o++){
        x[1] += d;
        if(x[1] != x[o]){
            printf("NO\n");
            return 0;
        }
    }
	//	以降、x[0]は無視
/*	for(int m = 1; m < N-1; m++){
		if( (x[m] - x[m-1] != x[m+1] - x[m])||(x[m] == 0) ){
			printf("NO\n");
			return 0;
		}
	}
*/
	
	printf("YES\n");
	return 0;
}
0