結果
問題 |
No.53 悪の漸化式
|
ユーザー |
![]() |
提出日時 | 2024-07-30 12:59:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 6,358 ms |
コンパイル使用メモリ | 299,892 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-30 12:59:26 |
合計ジャッジ時間 | 6,362 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; #include <boost/multiprecision/cpp_dec_float.hpp> namespace mp = boost::multiprecision; #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{ mp::cpp_dec_float_100 a = 4; mp::cpp_dec_float_100 b = 3; for(int i = 2;i<=n;i++){ mp::cpp_dec_float_100 c = 19 * b - 12 * a; c /= 4; a = b; b = c; } cout<<setprecision(30)<<fixed<<b<<endl; } }