結果

問題 No.112 ややこしい鶴亀算
ユーザー a2011404
提出日時 2017-03-22 15:41:44
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 17:39:57
合計ジャッジ時間 789 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:21:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |                 scanf("%d",&a[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include <stdlib.h>




int comp(const void *arg1, const void *arg2){

	return *(int *)arg1 - *(int *)arg2;

}



	int main(void){

	int i,n,a[50],x=0,y=0,min=0;
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}

	qsort(a, n, sizeof(int), comp);
	min=a[0];

	for(i=0;i<n;i++){
		if(a[i]==min)	x++;
		else		y++;
	}

	printf("%d %d",x,y);
	return 0;
}
0