文章

21

粉丝

0

获赞

6

访问

1.5k

头像
翻转数的和 题解:
P1003 兰州大学机试题
发布于2026年1月16日 19:03
阅读数 135

#include <stdio.h>  
#include <string.h>  
#include<iostream>
using namespace std;  

int fz(int a){
    int temp=a;
    int ans=0;
    while(temp>0){
        ans=ans*10;//防止答案差10倍,先乘
        int t=temp%10;
        temp=temp/10;
        ans+=t;
    }
    return ans;
}

int main() {  
   
    
    int a,b;
    while(cin>>a>>b){
        cout<<fz(a)+fz(b)<<endl;
    } 
    return 0;  

}  
 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发