题目连接
https://ac.nowcoder.com/acm/contest/23478/D
题面因为希望我们打乱后的01串和原串至少有一个位置不同,那么我们只需要随便找到一个值为1的位置和一个值为0的位置,然后交换即可
代码#include
using namespace std;
//----------------�Զ��岿��----------------
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
ll ksm(ll a,ll b) {
ll ans = 1;
for(;b;b>>=1LL) {
if(b & 1) ans = ans * a % mod;
a = a * a % mod;
}
return ans;
}
ll lowbit(ll x){return -x & x;}
const int N = 2e6+10;
//----------------�Զ��岿��----------------
int n,m,q,a[N];
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
cin>>n;
string s;
cin>>s;
int l = 0,r = 0;
for(int i = 0;i
关注
打赏