求调!回者必关
查看原帖
求调!回者必关
1283023
liumoumou_haha楼主2024/9/6 18:27
#include<bits/stdc++.h>
using namespace std;
int n,x;
bool op(int N)
{
	int p=0,sum=0,b=0;
	while(N)
	{
		N/=10;
		p++;//记录有多少位
	}
	while(N)
	{
		b=N%10;
		sum+=pow(b,p);//p为位数,逐位运算求和
		N/=10;
	}
	if(sum==N)
	{
		return false;
	}
	else
	{
		return true;
	}
}
int main()
{
	std::cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(op(x)==true) std::cout<<"T";
		else std::cout<<"F";	
	} 
	return 0;
}

2024/9/6 18:27
加载中...