結果

問題 No.53 悪の漸化式
ユーザー なお
提出日時 2014-10-30 23:26:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 272 bytes
コンパイル時間 1,516 ms
コンパイル使用メモリ 157,656 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 14:40:49
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:17: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat=]
   15 |     printf("%.16f\n", a[N]);
      |             ~~~~^     ~~~~
      |                 |        |
      |                 double   long double
      |             %.16Lf

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;

    long double a[101];
    a[0] = 4;
    a[1] = 3;
    for(int i = 2; i <= 100; i++){
        a[i] = (19*a[i-1] - 12*a[i-2]) / 4.0;
    }

    printf("%.16f\n", a[N]);
}
0