#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
int n,a,b,x,y;
string s,s2;
int main(){
ios_base::sync_with_stdio(0);
cin>>n>>s;
for(int i=0;i<8*n;i++)
if(s[i]=='0') a++; else b++;
if(b>6*n || b<3*n){
cout<<"NIE";
return 0;
}
b-=3*n;
x=b/3;
y=b%3;
for(int i=0;i<x;i++) s2+="w";
if(s2.length()==n){
cout<<s2;
return 0;
}
if(y==0) s2+="a"; else if(y==1) s2+="c"; else if(y==2) s2+="g";
for(int i=x+1;i<n;i++) s2+="a";
cout<<s2;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include<iostream> #include<cstdlib> #include<cstdio> using namespace std; int n,a,b,x,y; string s,s2; int main(){ ios_base::sync_with_stdio(0); cin>>n>>s; for(int i=0;i<8*n;i++) if(s[i]=='0') a++; else b++; if(b>6*n || b<3*n){ cout<<"NIE"; return 0; } b-=3*n; x=b/3; y=b%3; for(int i=0;i<x;i++) s2+="w"; if(s2.length()==n){ cout<<s2; return 0; } if(y==0) s2+="a"; else if(y==1) s2+="c"; else if(y==2) s2+="g"; for(int i=x+1;i<n;i++) s2+="a"; cout<<s2; return 0; } |
English