#include<iostream> using namespace std; int main(){ int a; cin>>a; int zi[a]; for(int i=0;i<a;i++){ cin>>zi[i]; } if(zi[0]==0){ for(int i=0;i<a;i++){ cout<<zi[i]; } cout<<" "; for(int i=0;i<a;i++){ cout<<zi[i]; } cout<<endl; }else if(zi[0]==1){ cout<<zi[0]; for(int i=1;i<a;i++){ if(zi[i]==0){ cout<<"1"; } if(zi[i]==1){ cout<<"0"; } } cout<<" "; cout<<zi[0]; for(int i=1;i<a-1;i++){ if(zi[i]==0){ cout<<"1"; } if(zi[i]==1){ cout<<"0"; } } cout<<"1"; } return 0; }
标签:std,反码,zi,int,补码,原码 From: https://www.cnblogs.com/guoliheng/p/18436420