legend


私信TA

用户名:dotcpp0599065

访问量:13805

签 名:

fish or cut baits

等  级
排  名 209
经  验 6267
参赛次数 0
文章发表 75
年  龄 0
在职情况 学生
学  校 黑龙江大学
专  业

  自我简介:

you can you up,no can don't bb

解题思路:说白了,就是进位与ASCII码值的转换

注意事项:

参考代码:

#include<stdio.h>

#include<string.h>


int main()

{

    char a[10000]={'0'};

    char b[10000]={'0'};

    int c[10000]={0};

    char d[10000]={0};

    int e[10000]={0};

    scanf("%s",a);

    scanf("%s",b);

    int i,j;

    int len=strlen(a);

    int len_1=strlen(b);

    int max;


    for(i=0,j=len-1;i<len;i++,j--)

        c[i]=a[j]-'0';

    for(i=0,j=len_1-1;i<len_1;i++,j--)

        d[i]=b[j]-'0';

    if(len>len_1)

    {

        max=len;

    }

    else

    {

        max=len_1;

    }

    for(i=0;i<max;i++)

    {

          e[i]=e[i]+c[i]+d[i];

          if(e[i]>9)

          {

              e[i+1]++;

              e[i]=e[i]-10;

          }

    }

    if(e[max]>0)

        max++;

    for(i=max-1;i>=0;i--)

    {

        printf("%d",e[i]);

    }

    printf("\n");

    return 0;

}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

为什么?
2022-12-14 14:42:14
  • «
  • 1
  • »