当前位置:网站首页>2021 ICPC Shaanxi warm up match b.code (bit operation)
2021 ICPC Shaanxi warm up match b.code (bit operation)
2022-07-25 05:33:00 【Vijurria】
B . CODE
Title Description
A length of (2^n)-1 Of 01 character string , The probability that every byte may be wrong is 1/10^20.
character string s, character s[i], For each of these i(i=2^k), s[i] Satisfy : s[i]=⨁(s[j]),j&i=i .【s[i] = the xor sum of all position j which k−th digit is 1 in binary representation.】
eg:s[3]=1,s[5]=1,s[6]=0,s[7]=1
then
s[1]=s[3]⨁s[5]⨁s[7]=1
s[2]=s[3]⨁s[6]⨁s[7]=0
s[4]=s[5]⨁s[6]⨁s[7]=0
The final message to be sent is 1010101.
Find the original string , You can assume that the given string has at most one error .Input
3 3 1010101 1010111 1110101Output
1010101 1010101 1010101
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const int N=200200;
const int M=5002;
const int mod=998244353;
LL a[N],f[M][M];
LL mp[N];
int b[N];
bool vis[N];
int dx[]={-1,0,0,1},dy[]={0,1,-1,0};
int main()
{
cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
int T=1;
cin>>T;
int n;
cin>>n;
while(T--)
{
string s;
cin>>s;
int len=s.size();
s=" "+s;
int flag=0;
for(int i=1;i<=len;i<<=1)
{
int sum=0;
for(int j=1;j<=len;j++)
{
if((j&i)==i&&(i!=j))
{
sum^=(s[j]-'0');
}
}
if(sum!=s[i]-'0') flag|=i;
}
if(flag!=0)
{
if(s[flag]=='0') s[flag]='1';
else s[flag]='0';
}
for(int i=1;i<=len;i++) cout<<s[i];
cout<<endl;
}
return 0;
}边栏推荐
- flex布局常用属性总结
- uniapp手机端uView的u-collapse组件高度init
- The global shipment of glory 8x series exceeded 10million units, and the glory V20 exceeded 1.5 million units!
- LCP plug-in creates peer-to-peer physical interface
- 微服务及相关组件概念
- odoo14 | 关于状态栏statusbar关键词使用后显示异常及解决方法
- 50: Chapter 5: develop admin management service: 3: develop [query whether the admin user name already exists, interface]; (this interface can only be called when logging in; so we have written an int
- FinClip实现微信授权登录的三种方案
- Uniapp custom application exit execution content
- Wechat applet related operation examples
猜你喜欢

Thesis reading | which is the best multilingual pre training technology for machine translation? See the latest progress!

1310_一个printf的实现分析

C Programming -- the solution of dynamic programming of "the sum of the largest subarray"

Unity接入ChartAndGraph图表插件

The difference between function and task in SystemVerilog

Build keyword driven automated testing framework

微服务 - 远程调用(Feign组件)

Win11 how to view the file explorer tab

odoo14 | 关于状态栏statusbar关键词使用后显示异常及解决方法

微信小程序相关操作示例
随机推荐
Project management tool - Introduction and practice of Alibaba cloud projex
Performance Optimization: how to solve the slow loading speed of the first screen of spa single page application?
background
弹性布局总结
The difference between $write and $display in SystemVerilog
STL notes (VIII): container - List
The global shipment of glory 8x series exceeded 10million units, and the glory V20 exceeded 1.5 million units!
LCP plug-in creates peer-to-peer 802.1ad interface
Oracle 用户A删除用户B名下的一张表后,用户B可以通过回收站恢复被删除的表吗?
Solution of win11 blue screen code 0x0000001a
Implement is by yourself_ base_ of
Deep error
聊聊 Redis 是如何进行请求处理
Powering 5g notebook market, Wentai technology joined the "Honghu plan"
What should testers do if they encounter a bug that is difficult to reproduce?
Introduction summary of using unirx in unity
Summary of common attributes of flex layout
Browser cache HTTP cache CDN cache localstorage / sessionstorage / cookies
微服务 - 网关Gateway组件
基环树入门