結果

問題 No.2815 Smaller than all
ユーザー highlighter
提出日時 2024-07-04 01:02:43
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 02:12:17
合計ジャッジ時間 2,583 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&N);
      |         ^~~~~~~~~~~~~~
main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d",&A[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	int A[N];
	for(int i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	int r=N;
	for(int i=1;i<N;i++){
		if(A[i]>A[i-1]){
			r=i;
			break;
		}
	}
	int ans=0;
	for(int i=r-1;i>=0;i--){
		if(A[i]==A[r-1]){
			ans++;
		}
	}
	printf("%d\n",ans);
}
0