結果

問題 No.182 新規性の虜
ユーザー しめはじめ
提出日時 2019-08-08 17:43:16
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 916 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 20:43:13
合計ジャッジ時間 1,538 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
    int n;
    scanf( "%d", &n );
    int i;
    int num[3];
    int ans = 0;
    if( n == 1 ){
        ans = 1;
    }else{
        scanf( "%d", &num[0] );
        scanf( "%d", &num[1] );
        if( n == 2 ){
            if( num[0] == num[1] ){
                ans = 0;
            }else{
                ans = 1;
            }
        }else{
            if( num[0] != num[1] ){
                ans++;
            }
            for( i = 3; i <= n; i++ ){
                scanf( "%d", &num[2] );
                if( num[0] != num[1] && num[1] != num[2] ){
                    ans++;
                }
                //ずらす
                if( i < n ){
                    num[0] = num[1];
                    num[1] = num[2];
                }
            }
            if( num[1] < num[2] ){
                ans++;
            }
        }
    }
    printf( "%d\n", ans );
}
0