結果

問題 No.677 10^Nの約数
ユーザー butsurizukibutsurizuki
提出日時 2018-06-08 15:51:30
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 821 ms
コンパイル使用メモリ 29,256 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 23:20:27
合計ジャッジ時間 1,842 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:4:11: 警告: conflicting types for built-in function ‘pow’; expected ‘double(double,  double)’ [-Wbuiltin-declaration-mismatch]
    4 | long long pow(long long a,long long n){
      |           ^~~
main.c:3:1: 備考: ‘pow’ is declared in header ‘<math.h>’
    2 | #include<stdlib.h>
  +++ |+#include <math.h>
    3 | 
main.c: 関数 ‘main’ 内:
main.c:29:35: 警告: 互換性のないポインタ型から 4 番目の ‘qsort’ の引数に渡しています [-Wincompatible-pointer-types]
   29 |     qsort(arr,q,sizeof(long long),sortfnc);
      |                                   ^~~~~~~
      |                                   |
      |                                   long long int (*)(const void *, const void *)
次のファイルから読み込み:  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 long int (*)(const void *, const void *)’
  828 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~

ソースコード

diff #

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

long long pow(long long a,long long n){
    long long r=1,i;
    for(i=0;i<n;i++){r*=a;}
    return r;
}

long long sortfnc(const void *a,const void *b) {
  if(*(long long *)a < *(long long *)b){
    return -1;
  }
  else if(*(long long *)a == *(long long *)b){
    return 0;
  }
  return 1;
}

int main(){
    long long q,i,j,n,arr[512];
    scanf("%lld",&n);
    for(i=0;i<=n;i++){
        for(j=0;j<=n;j++){
            arr[n*i+j]=pow(2,i)*pow(5,j);
        }
    }
    q=(n+1)*(n+1);
    qsort(arr,q,sizeof(long long),sortfnc);
    for(i=0;i<q;i++){printf("%lld\n",arr[i]);}
    return 0;
}
0