結果
| 問題 | No.677 10^Nの約数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-26 01:24:58 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 608 bytes |
| 記録 | |
| コンパイル時間 | 78 ms |
| コンパイル使用メモリ | 39,936 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-21 21:54:00 |
| 合計ジャッジ時間 | 4,907 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 1 -- * 8 |
コンパイルメッセージ
main.c: In function 'main':
main.c:32:24: warning: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
32 | qsort(a, j, 8, q);
| ^
| |
| long int (*)(const long int *, const long int *)
In file included from main.c:2:
/usr/include/stdlib.h:971: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 *)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
main.c:5:6: note: 'q' declared here
5 | long q(const long *a, const long *b)
| ^
/usr/include/stdlib.h:948:15: note: '__compar_fn_t' declared here
948 | typedef int (*__compar_fn_t) (const void *, const void *);
| ^~~~~~~~~~~~~
ソースコード
#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;
}