L1-096 谁管谁叫爹

int类型最多表示的21亿,这个题int就可以。

#include <bits/stdc++.h>
using namespace std;
int getSum(int a){
	int res = 0;
	while(a){
		res += a%10;
		a/=10;
	}
	return res;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		int a,b;
		cin>>a>>b;
		int s1=getSum(a);
		int s2=getSum(b);
		if(a%s2==0&&b%s1==0){//都满足 
			cout << (a > b ? "A":"B") << '\n'; 
		}else if(a%s2==0){
			cout << "A" << '\n';
		}else if(b%s1==0){
			cout << "B" << '\n';
		}else{
			cout << (a > b ? "A":"B") << '\n';
		}
	}
	return 0;
}
posted @ 2024-04-02 10:18  YuKiCheng  阅读(37)  评论(0编辑  收藏  举报