結果

問題 No.677 10^Nの約数
ユーザー Mcpu3
提出日時 2018-06-27 22:03:03
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 32,000 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 23:15:38
合計ジャッジ時間 837 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:20:24: warning: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   20 |         qsort(a, k, 8, q);
      |                        ^
      |                        |
      |                        long int (*)(const long int *, const long int *)
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 'long int (*)(const long int *, const long int *)'
  839 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~

ソースコード

diff #

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

long q(const long *a, const long *b)
{
	return *a - *b;
}

int main(void)
{
	long n, i, j, k = 0, a[999], t = 0;
	scanf("%ld", &n);
	for (i = 0; i <= n; i++) {
		for (j = 0; j <= n; j++) {
			a[k] = (long)pow(2, i) * (long)pow(5, j);
			k++;
		}
	}
	qsort(a, k, 8, q);
	for (i = 0; i < k; i++) {
		if (a[i] != t) printf("%ld\n", a[i]);
		t = a[i];
	}
	return 0;
}
0