Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6566 | 谢锦卓 | 数字反转 | C++ | Accepted | 0 MS | 260 KB | 899 | 2025-03-08 09:01:32 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,a,b,rev_a,rev_b; int temp; cin>>n; while(n--){ cin>>a>>b; temp=a; rev_a=0; while(temp!=0){ rev_a=rev_a*10+temp%10; temp/=10; } temp=b; rev_b=0; while(temp!=0){ rev_b=rev_b*10+temp%10; temp/=10; } int rev_ab=0; temp=a+b; while(temp!=0){ rev_ab=rev_ab*10+temp%10; temp/=10; } if(rev_ab==rev_a+rev_b){ cout<<a+b<<endl; } else{ cout<<"NO"<<endl; } } return 0; }