結果

問題 No.677 10^Nの約数
ユーザー Mcpu3Mcpu3
提出日時 2018-06-26 01:24:58
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 29,848 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-13 14:00:41
合計ジャッジ時間 6,124 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
8,756 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 22 ms
4,380 KB
testcase_08 AC 210 ms
4,376 KB
testcase_09 TLE -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:32:24: 警告: 互換性のないポインタ型から 4 番目の ‘qsort’ の引数に渡しています [-Wincompatible-pointer-types]
   32 |         qsort(a, j, 8, q);
      |                        ^
      |                        |
      |                        long int (*)(const long int *, const long int *)
次のファイルから読み込み:  main.c:2:
/usr/include/stdlib.h:828:34: 備考: expected ‘__compar_fn_t’ {aka ‘int (*)(const void *, const void *)’} but argument is of type ‘long int (*)(const long int *, const long int *)’
  828 |                    __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 = 0, a[100000], s, t = 0;
	scanf("%ld", &n);
	s = (long)pow(10, n);
	if (n == 0) {
		puts("1");
		return 0;
	}
	puts("1");
	for (i = 2; i <= s / 5; i += 2) {
		if (s % i == 0) {
			a[j] = i;
			j++;
		}
	}
	for (i = 5; i <= s / 2; i += 5) {
		if (s % i == 0) {
			a[j] = i;
			j++;
		}
	}
	qsort(a, j, 8, q);
	for (i = 0; i < j; i++) {
		if (t != a[i]) printf("%ld\n", a[i]);
		t = a[i];
	}
	printf("%ld", s);
	return 0;
}
0