結果

問題 No.53 悪の漸化式
ユーザー momoyuu
提出日時 2024-07-30 12:50:32
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 103,688 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-30 12:50:35
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

#include<iomanip>
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;
    if(n==0) cout<<4<<endl;
    else if(n==1) cout<<3<<endl;
    else{
        long double a = 4;
        long double b = 3;
        for(int i = 2;i<=n;i++){
            long double c = 19 * b - 12 * a;
            c /= 4;
            a = b;
            b = c;
        }
        cout<<setprecision(30)<<fixed<<b<<endl;
    }
}   

0