数字最多有20位,乘2后达到21位,超过了最大整数longlong型的范围(20位),故不能直接以longlong类型读入(有上溢用例,只能得15分)
以下是纯C写法:
#include<stdio.h>
#include<string.h>
#define MAX_BITS 21
int main()
{
int a[10]={
0}, b[10]={
0}, N[MAX_BITS]={
-1}, M[MAX_BITS]={
-1}, len;
char tmp, str[MAX_BITS];
scanf("%s", str)