提交时间:2021-05-12 20:46:41
运行 ID: 19251
#include<bits/stdc++.h> using namespace std; int n,r,a[100001],x,b[100001],sum,l,flag; int main(){ int n; cin>>n>>x>>r; a[1]=r%4+1; for(int i=2;i<=n;i++){ r=(r*6807+2831)%201701; a[i]=r%4+1; } for(int i=1;i<=n+1-x;i++){ flag=1,sum=0; for(int j=i;j<=i+x-1;j++){ sum*=10; sum+=a[j]; } for(int j=1;j<=l;j++){ if(b[j]==sum) flag=0; } if(flag==1) b[++l]=sum; } cout<<l; }