1默认是int,将其类型转换成long long,不然会出现答案不符合预期的情况(符号位、二进制位不够等问题)
#include <iostream>
using namespace std;
void output(long long n)
{
if(n&(1LL<<32))cout<<1;
for(int j=31;j>=0;j--)cout<<(n&(1LL<<j)?1:0);
cout<<endl;
}
int main()
{
int t;cin>>t;
while(t--)
{
string str;
cin>>str;
long long temp=0;
for(int i=str.size()-1,j=0;i>=0;j++,i--)
{
if(str[i]=='1')temp^=(1LL<<j);
}
output(temp+1LL);
// cout<<temp+1LL<<endl;
output(temp+3);
}
return 0;
}