Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34473 | masppy | 【S】T1 | C++ | 解答错误 | 40 | 11 MS | 25896 KB | 1343 | 2024-11-10 12:41:54 |
#include<bits/stdc++.h> #define ll long long #define lson pos<<1 #define rson pos<<1|1 using namespace std; const int maxn=2e5+10; const ll mod=1e9+7; const ll inf=1e10; ll n,m,k,t,ans=0; ll a[maxn],vis[20],mut[maxn][20],C[20][20],dp[maxn][20]; char c[maxn],s[maxn]; int main(){ // freopen("math.in","r",stdin); // freopen("math.out","w",stdout); scanf("%lld",&n); scanf("%s",c+1); scanf("%s",s+1); scanf("%lld",&m); if(n<=10){ int tmp=0,tmp1=0; for(int i=1;i<=n;i++){ tmp*=10; tmp+=c[i]-'0'; tmp1*=10; tmp1+=s[i]-'0'; } // cout<<tmp<<" "<<tmp1<<endl; for(int i=tmp;i<=tmp1;i++){ for(int j=0;j<=9;j++) vis[j]=0; int k=i,cnt=0; while(k){ if(!vis[k%10]) vis[k%10]=1,cnt++; k/=10; } if(cnt==m) ans++; } printf("%lld",ans); fclose(stdin); fclose(stdout); } for(int i=1;i<=n;i++){ mut[i][1]=1; for(int j=2;j<=10;j++) mut[i][j]=(mut[i-1][j]*j)%mod; } C[0][0]=1; for(int i=1;i<=10;i++){ C[i][0]=1; for(int j=1;j<=i;j++){ C[i][j]=C[i-1][j]+C[i-1][j-1]; } } fclose(stdin); fclose(stdout); return 0; }