結果

問題 No.702 中央値を求めよ LIMITED
ユーザー ciel
提出日時 2018-06-17 22:44:21
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 431 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 17,392 KB
最終ジャッジ日時 2024-06-30 16:38:11
合計ジャッジ時間 10,440 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:20:21: warning: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   20 |         qsort(a,n,4,"\x8b\7+\6\xc3");
      |                     ^~~~~~~~~~~~~~~
      |                     |
      |                     char *
In file included from main.c:2:
/usr/include/stdlib.h:839:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'char *'
  839 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
unsigned int x=0,y=1,z=2,w=3,a[6000000],k;
unsigned int generate(){
	unsigned int t = (x^(x<<11));
	x = y;
	y = z;
	z = w;
	w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
	return w;
}
int main(){
	unsigned int i=0,n=0,m=0;
	scanf("%u",&x);
	for(;i<7000001;i++){
		k=generate();
		if(k<1U<<30)m++;
		else if(k<(1U<<31|1U<<30))a[n++]=k;
	}
	qsort(a,n,4,"\x8b\7+\6\xc3");
	printf("%u\n",a[5000000-m]);
}
0