提交时间:2022-06-12 07:03:31
运行 ID: 41435
#include <bits/stdc++.h> using namespace std; int main() { int i,n,s,minn,ans=0,a[200]={0},b[200]={0}; cin>>n>>s; for(i=1;i<=n;++i) { s=(s*345)%19997; a['a'+s%26]++; } for(i=1;i<=n;++i) { s=(s*345)%19997; b['a'+s%26]++; } for(i='a';i<='z';++i) { minn=min(a[i],b[i]); ans+=a[i]-minn; } cout<<ans; return 0; }