競プロ用のメモ

競プロのメモです。競プロで得たc++の知識を書きます。atcoder緑が書いてます。

2022-10-30から1日間の記事一覧

自作バグ:メモ再帰で関数と配列の取り違え

EDPCのJ問題,すしのやつ https://atcoder.jp/contests/dp/tasks/dp_j ```cpp double f(int s1,int s2,int s3){ if(seen[s1][s2][s3]) return dp[s1][s2][s3]; seen[s1][s2][s3]=true; double res=1; if(s1>0) res+=f(s1-1,s2,s3)*s1/n; if(s2>0) res+=f(s1+…

modintのコンパイルエラー

拾ってきたmodintをコンパイルオプション付きでコンパイルすると,エラーを吐く. main.cc: In constructor ‘mint::mint(long long int)’: main.cc:12:20: warning: declaration of ‘x’ shadows a member of ‘mint’ [-Wshadow] 12 | mint(long long x=0) : x…