class Solution {
public:
int numDistinct(string s, string t) {
long n=s.size(),m=t.size();
s=' '+s;t=' '+t;
vector<vector<uint64_t>> f(n+1,vector<uint64_t>(m+1));
for(int i=0;i<=n;i++) f[i][0]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
f[i][j]=f[i-1][j];
if(s[i]==t[j]) f[i][j]+=f[i-1][j-1];
}
}
return f[n][m];
}
};
//vector<vector<long long>>报溢出,换成unit64_t
09-08
1096
09-13
995