結果
問題 | No.560 ふしぎなナップサック |
ユーザー | btk |
提出日時 | 2017-08-25 23:34:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 998 bytes |
コンパイル時間 | 1,841 ms |
コンパイル使用メモリ | 169,848 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 16:13:58 |
合計ジャッジ時間 | 2,407 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long LL; #define CIN_ONLY if(1) struct cww{cww(){ CIN_ONLY{ ios::sync_with_stdio(false);cin.tie(0); cout<<fixed; cout<<setprecision(10); } }}star; #ifdef BTK #define DEBUG if(1) #else #define DEBUG if(0) #endif #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define REC(ret, ...) std::function<ret (__VA_ARGS__)> template <typename T>inline bool chmin(T &l,T r) {bool a=l>r;if(a)l=r;return a;} template <typename T>inline bool chmax(T &l,T r) {bool a=l<r;if(a)l=r;return a;} template <typename T> istream& operator>>(istream &is,vector<T> &v){ for(auto &it:v)is>>it; return is; } typedef vector<double> V; int main(){ int M,N; cin>>M>>N; V dp(N+1,M); REP(i,N) dp[i+1]=(dp[i]*2+dp[i]+1)/3.0; cout<<dp.back()<<endl; return 0; }