You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
837 B
45 lines
837 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int chenghebi(int u) {
|
|
int t = u * 7;
|
|
int sum = 0;
|
|
while (t > 9) {
|
|
sum = t / 10 + t % 10;
|
|
t = sum;
|
|
}
|
|
return t;
|
|
}
|
|
|
|
int main() {
|
|
int T;
|
|
cin >> T;
|
|
while (T--) {
|
|
int n;
|
|
int dj = 0;
|
|
int k = 0;
|
|
int c[10000] = {0};
|
|
cin >> n;
|
|
while (n != 0) {
|
|
dj++;
|
|
int a = n % 10;
|
|
if ( dj% 2 == 0)
|
|
c[dj] = a;
|
|
else
|
|
c[dj] = chenghebi(a);
|
|
n /= 10;
|
|
}
|
|
for (int i = dj; i >= 1; i--) {
|
|
k *= 10;
|
|
k += c[i];
|
|
|
|
}
|
|
|
|
if (k % 8 == 0)
|
|
cout << "T" << endl;
|
|
else
|
|
cout << "F" << endl;
|
|
}
|
|
|
|
return 0;
|
|
} |