文章

93

粉丝

56

获赞

264

访问

21.4k

头像
十六进制不进位加法 题解:暴力,厦大我来力
P1702 厦门大学机试题
发布于2025年3月15日 00:04
阅读数 216

#include <bits/stdc++.h>
using namespace std;
//输入两字符串,都反转,得到短的那个长度,遍历,每个转数字,相加取模

char qiuhe(char a,char b)
{
    int c,d;
    if(a>='0'&&a<='9')
    {
        c=a-'0';
    }
    else
    {
        c=a-'A'+10;
    }
    if(b>='0'&&b<='9')
    {
        d=b-'0';
    }
    else
    {
        d=b-'A'+10;
    }
    if((c+d)%16<10)return (c+d)%16+'0';
    else return(c+d)%16+'A'-10;
}


int main()
{
    string str1,str2;
    while(cin>>str1>>str2)
   ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发