求助
查看原帖
求助
966827
User966827楼主2024/4/21 09:29

思绪太乱,勿喷

#include<bits/stdc++.h>
using namespace std;
long long n;
int sum(long long s)
{
	int t=0;
	while(s)
	{
		t+=s%10;
		s/=10;
	}
	return t;
}
int luck(long long x)
{
	int k=x%10*7;
	while(k>9)
	{
		k=sum(k);
	}
	return k;
}
bool check(long long T)
{
	long long ans,cnt=0;
	while(T)
	{
		ans=ans+luck(T)*pow(cnt,10);
		T/=10;
		cnt++;
	}
	return ans%8;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		long long h,p=0;
		cin>>h;
		if(check(h))
		{
			cout<<'T'<<endl;
		}
		else
		{
			cout<<'F'<<endl;
		}
	}
	return 0;
}
2024/4/21 09:29
加载中...