返回小组 开始 2025-03-09 13:30:00

测验2

结束 2025-03-09 18:00:00
Contest is over.
当前 2025-4-16 06:01:51

5

include <bits/stdc++.h>

using namespace std;

int solve(int x) {

int d = 0;
while (x) {
	d += x % 10;
	x /= 10;
}
return d;

}

bool j(long long x) {

int a = 1;
int sum = 0;
while (x) {
	int b = x % 10;
	x /= 10;
	if (a % 2 == 1) {
		int c = b * 7;
		while (c > 9)
			c = solve(c);
		b = c;
	}
	sum	+= b;
	a++;
}
return sum % 8 == 0;

}

int main() {

int n;
cin >> n;
while (n--) {
	long long q;
	cin >> q;
	if (j(q))
		cout << "T" << endl;
	else
		cout << "F" << endl;
}
return 0;

}


zhaoyihao  •  1个月前

比赛已结束。