結果

問題 No.53 悪の漸化式
ユーザー satanic
提出日時 2016-04-17 18:19:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 68,876 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 10:27:19
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

double RepeatSquaring(double n, int p){
    if(p==0) return 1;
    if(p%2==0) return std::pow(RepeatSquaring(n, p/2), 2);
    else return n*RepeatSquaring(n, p-1);
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    int N;
    std::cin >> N;
    std::cout << std::fixed << std::setprecision(10) << 4*RepeatSquaring(3.0/4.0, N) << "\n";

    return 0;
}
0