結果

問題 No.116 門松列(1)
ユーザー 👑 testestest
提出日時 2015-08-06 00:01:01
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 182 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 20,096 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 01:07:22
合計ジャッジ時間 1,516 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 | scanf("%d%d%d",&n,&a,&b);n-=2;
      | ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&c);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
int a,b,c,n,s=0;
scanf("%d%d%d",&n,&a,&b);n-=2;
while(n--){
	scanf("%d",&c);
	if(a-c&&(a<b&&c<b||b<a&&b<c))s++;
	a=b;b=c;
}
printf("%d",s);
return 0;
}
0