ZJNU 1372 - 破解情书
作者:互联网
取模运算在数组内循环解密,否则会MLE
1 /* 2 Written By StelaYuri 3 */ 4 #include<stdio.h> 5 char cm[210],cn[1000010]; 6 int main() 7 { 8 int i,j,s1,s2,n,m,l,k; 9 scanf("%d%d%d%d%s%s",&n,&m,&l,&k,cm,cn); 10 for(i=(n-1+l)%n,s1=0;s1<k;s1++,i=(i+l)%n) 11 for(j=(i-m+1+n)%n,s2=0;s2<m;s2++,j=(j+1)%n) 12 { 13 if(cn[j]=='0') 14 cn[j]=cm[s2]; 15 else 16 cn[j]=1-(cm[s2]-'0')+'0'; 17 } 18 for(i=(k*l)%n,s1=0;s1<n;s1++,i=(i+1)%n) 19 putchar(cn[i]); 20 21 return 0; 22 }
标签:情书,cn,cm,int,s1,d%,char,1372,ZJNU 来源: https://www.cnblogs.com/stelayuri/p/12235261.html