忘了改了什么,后来居然对了!做打不死的菜鸟!
#include <stdio.h> #include <stdbool.h> #define arrayLength 20 #define bitMax 1000 main(){ int caseCount = 0; scanf_s("%d", &caseCount); char inputA[arrayLength][bitMax]; char inputB[arrayLength][bitMax]; char result[arrayLength][bitMax + 1]; for (int i = 0; i < caseCount; i++){ scanf_s("%s", &inputA[i][0], 1000); scanf_s("%s", &inputB[i][0], 1000); } //Calculating... result[0],result[1] for (int caseNum = 0; caseNum < caseCount; caseNum++) { char *ptrA, *ptrB, *ptrResult; ptrA = inputA[caseNum]; ptrB = inputB[caseNum]; ptrResult = result[caseNum]; int lengthA = getLength(ptrA); int lengthB = getLength(ptrB); int lengthMax = lengthA>lengthB ? lengthA : lengthB; //Fill A or B with zero if (lengthA > lengthB){ ptrB += lengthB; for (int j = 0; j <= lengthB; j++) { char temp = *ptrB; *(ptrB + lengthA - lengthB) = temp; ptrB--; } ptrB = inputB[caseNum]; for (int i = 0; i < lengthA - lengthB; i++){ *ptrB = '0'; ptrB++; } } else { ptrA += lengthA; for (int j = 0; j <= lengthA; j++) { char temp = *ptrA; *(ptrA + lengthB - lengthA) = temp; ptrA--; } ptrA = inputA[caseNum]; for (int i = 0; i < lengthB - lengthA; i++){ *ptrA = '0'; ptrA++; } } for (int i = 0; i <= lengthMax; i++){ *ptrResult = '0'; ptrResult++; } *ptrResult = '