#include <stdio.h> #include<stdlib.h> #include <string.h> char*
addBinary(char* a, char* b) { int n1,n2,i,j,k,fab=0,g; char* c,*d;
n1=strlen(a); n2=strlen(b); if(n1>=n2) { g=k=n1-1; d=(char*)malloc(k+2);
strcpy(d,a); } else if(n1<n2) { g=k=n2-1; d=(char*)malloc(k+1); strcpy(d,b); }
c=(char*)malloc(k+2); for(i=n1-1,j=n2-1;i>=0&&j>=0;i--,j--,k--) {
if((a[i]-'0')+(b[j]-'0')+fab==0||(a[i]-'0')+(b[j]-'0')+fab==1) {
c[k]=a[i]+b[j]+fab-'0'; fab=0; } else if((a[i]-'0')+(b[j]-'0')+fab==2) {
c[k]='0'; fab=1; } else if((a[i]-'0')+(b[j]-'0')+fab==3) { c[k]='1'; fab=1; } }
for(;k>=0;k--) { c[k]=d[k]+fab; if(c[k]=='2') { c[k]='0'; fab=1; } else fab=0;
} if(fab==1) { for(i=g;i>=0;i--) { c[i+1]=c[i]; } c[0]='1'; }
for(i=0;i<=g+1;i++) { if(c[i]!='0'&&c[i]!='1') { c[i]='\0'; } } return c; } int
main() { char a[]="10011",b[]="10000011"; printf("%s",addBinary(a,b)); return
0; } </textarea>
The last test case was right , The submission overflows

Technology
©2019-2020 Toolsou All rights reserved,
( Essence )2020 year 7 month 21 day ASP.NET Core Use of global filters ( Essence )2020 year 7 month 30 day Wechat applet Use of modules ( Essence )2020 year 6 month 26 day C# Class library Loop execution help class ajax get Request Chinese parameter garbled solution python obtain excel A column or row of data ( Essence )2020 year 6 month 29 day C# Class library Interface signature verification keras from dataframe Read data and enhance the data for training ( classification + division )Java Thread of Sleep() Summary of usage python read , write in txt Text content ( Essence )2020 year 7 month 15 day Wechat applet assembly Component Use of