只得了20分,想了好久了
查看原帖
只得了20分,想了好久了
1228547
Jasper111楼主2024/3/29 20:00
#include <bits/stdc++.h>
using namespace std;
long long int a, sum, jaop = 1, a_2;
int g(int f)
{
	int summ = 0;
	while (f)
	{
		summ += f % 10;
		f /= 10;
	}
	return summ;
}
int aa(int x)
{
	if (x == 1)
	{
		return 7;
	}
	x *= 7; 
	x = g(x);
	while (true)
	{
		if (x <= 9)
		{
			return x;
		}
		else
		{
			x = g(x);
		}
	}
}
void panduan(int t)
{
	jaop = 1;
	sum = 0;
	while (t)
	{
		if (jaop % 2 != 0)
		{
			sum += aa(t % 10);
			t /= 10;
		}
		else
		{
			sum += t % 10;
			t /= 10;
		}
		jaop++;
	}
	if (sum % 8 == 0)
	{
		cout << 'T' << endl;
	}
	else
	{
		cout << 'F' << endl;
	}
}
int main()
{
	cin >> a;
	for (int i = 1; i <= a; i++)
	{
		cin >> a_2;
		panduan(a_2);
	}
	return 0;
}
2024/3/29 20:00
加载中...