Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
5535 邓小龙 数字反转 C++ Accepted 0 MS 260 KB 683 2024-11-28 20:27:14

Tests(1/1):


Code:

#include<iostream> using namespace std; int main(){ int a,b,n,m,num;//n存反转之和,m存和 cin>>num; for(int i=1;i<=num;i++){ cin>>a>>b; m=a+b;//存a+b int temp=m; int m_r=0;//存m的反转 while(m!=0){ m_r=m_r*10+m%10; m/=10; } //cout<<m_r<<endl; int a_r=0; while(a!=0){ a_r=a_r*10+a%10; a/=10; } int b_r=0; while(b!=0){ b_r=b_r*10+b%10; b/=10; } n=a_r+b_r; if(m_r==n) cout<<temp<<endl; else cout<<"NO"<<endl; } return 0; }