結果

問題 No.454 逆2乗和
ユーザー ndifix
提出日時 2016-12-07 16:48:57
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 230 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 21,760 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 03:23:15
合計ジャッジ時間 1,133 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:13: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘double *’ [-Wformat=]
    8 |     scanf("%d",&x);
      |            ~^  ~~
      |             |  |
      |             |  double *
      |             int *
      |            %le
main.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d",&x);
      |     ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
    double a=0;
    double x;
    int i;
    
    scanf("%d",&x);
    for(i=1; i<=x; i++){
        a+= 1/ (i*i);
    }
    
    a= 1.6449340668482426 -a;
    printf("%.9f\n",a);
    
    return 0;
}
0