文章

79

粉丝

221

获赞

45

访问

162.2k

头像
两翻转数的和
P1003 兰州大学机试题
发布于2023年3月17日 19:20
阅读数 2.3k

#include <iostream>
using namespace std;
int Rev(int n){
	int res =0;
	while(n>0){
		res =res*10+n%10;
		n/=10;
	}
	return res;
}
int main() {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int s =Rev(a)+Rev(b);
		cout<<s<<endl;
	}
	return 0;
}

注意,当题目中有多组输入时要使用

while(scanf("%d %d",&a,&b)!=EOF)

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发