提交时间:2022-06-19 17:31:39

运行 ID: 41975

#include<iostream> short n,s,a[26],b[26],sum; int main(){ scanf("%hd %hd",&n,&s); for(short i=0;i<n;i++){ s=s*345%19997; a[s%26]++; } for(short i=0;i<n;i++){ s=s*345%19997; b[s%26]++; } for(short i=0;i<26;i++){ sum+=b[i]-a[i]>0?b[i]-a[i]:0; } printf("%hd",sum); return 0; }