提交时间:2022-06-11 16:46:56

运行 ID: 41282

#include<bits/stdc++.h> using namespace std; string s1,s2; int n,s; int ans; int main(){ cin>>n>>s; for(int i=1;i<=n;i++){ s=(s*345)%19997; s1=s1+(char)(97+(s%26)); } for(int i=1;i<=n;i++){ s=(s*345)%19997; s2=s2+(char)(97+(s%26)); } int a1=s1.length()-1,a2=s2.length()-1; for(int i=0;i<=a1;i++){ for(int j=0;j<=a2;j++){ if(s1[i]==s2[j]) s2[j]='0',s1[i]='0'; } } for(int i=0;i<=a2;i++){ if(s2[i]!='0') ans++; } cout<<ans; return 0; }