解题思路:
注意事项:
参考代码:
#include<iostream> #include<cstring> #include<string> #include<algorithm> #include<cmath> using namespace std; typedef long long LL; int f[1050][1050]; int main() { string str; LL n, m; cin >> n >> m >> str; int t = log2(n); t = pow(2, t) == m ? t : t +1; LL mod = pow(2, t); m = m % mod; while(m--){ string temp = "0" + str; temp.pop_back(); for(int i = 0; i < n; i++){ str[i] = (str[i] ^ temp[i]) + '0'; } } cout << str << endl; return 0; }
0.0分
0 人评分