結果

問題 No.116 門松列(1)
ユーザー 👑 testestest
提出日時 2015-08-06 00:02:18
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 180 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 01:08:22
合計ジャッジ時間 1,061 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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);
	a-c&&(a<b&&c<b||b<a&&b<c)&&s++;
	a=b;b=c;
}
printf("%d",s);
return 0;
}
0