結果
| 問題 | No.677 10^Nの約数 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-06-26 01:22:47 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 605 bytes | 
| コンパイル時間 | 137 ms | 
| コンパイル使用メモリ | 31,744 KB | 
| 実行使用メモリ | 13,756 KB | 
| 最終ジャッジ日時 | 2024-06-30 22:46:50 | 
| 合計ジャッジ時間 | 6,040 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 1 | 
| other | AC * 6 WA * 1 TLE * 2 -- * 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);
      |                        ^
      |                        |
      |                        int (*)(const int *, const 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 'int (*)(const int *, const int *)'
  839 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int q(const int *a, const int *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 == 1) {
		puts("0");
		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;
}
            
            
            
        