题解 | #还是A+B#

还是A+B

https://www.nowcoder.com/practice/8c3c5dae2c4a4266ba04f993a18e286b

#include <stdbool.h>
#include <stdint.h>
#include<stdio.h>
bool f(int A,int B,int K)
{
    int i;
    for(i=0;i<K;i++)
    {
        if(A%10!=B%10)return false;
        A/=10;
        B/=10;
    }
    return true;
}
int main()
{
    int A,B,K;
    scanf("%d %d %d",&A,&B,&K);
    if(f(A,B,K)==true)printf("-1\n");
    else printf("%d\n",A+B);
    return 0;
}

全部评论

相关推荐

06-18 13:28
已编辑
门头沟学院 Web前端
爱睡觉的冰箱哥:《给予你300的工资》,阴的没边了
点赞 评论 收藏
分享
龙珠传说:nb,公务员解约不需要支付违约金吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务