結果

問題 No.406 鴨等間隔の法則
コンテスト
ユーザー nxteru
提出日時 2017-03-23 21:40:22
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 618 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 169 ms
コンパイル使用メモリ 39,488 KB
最終ジャッジ日時 2026-02-21 23:33:12
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 23 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
int main(void){
    int N,b;
    int e=0;
    scanf("%d",&N);
    int a[N];
    for(b=0;b<N;b++){
        scanf("%d",&a[b]);
    }
    for(b=0;b<N;b++){
       if(a[b]==a[b+1]){
       e=1;
       break;
       }
       
    }
if(e==0){
    int c=a[0]; 
    for(b=1;b<N;b++){
        if(c>a[b])
        c=a[b];
    }
    int d=100000000;
    for(b=0;b<N;b++){
        if(a[b]==c)
        continue;

         if(d>a[b])
        d=a[b];
    }        
    d-=c;   
    for(b=0;b<N;b++){
        if((a[b]-a[b+1])%d!=0)
        break;
    }
   printf((a[b]-a[b+1])%d==0?"YES":"NO");
}else
printf("NO");
}
0