study/src/luckyNumber.cpp
2024-01-23 19:03:41 +08:00

37 lines
784 B
C++

#include <iostream>
#include <string>
int main() {
int n;
std::cin >> n;
std::string slistn[n];
for (int i = 0; i < n; i++) {
std::getline(std::cin, slistn[i]);
for (int j = 0; j < slistn[i].size(); j++) {
slistn[i][j] = slistn[i][j] - '0';
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
slistn[i][j] *= 7;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j += 2) {
while (slistn[i][j] > 9) {
slistn[i][j] = (slistn[i][j] / 10) + (slistn[i][j] % 10);
}
}
}
int sum[n];
for (int i = 0; i < n; i++) {
for (int j : slistn[i]) {
sum[i] += j;
}
if (sum[i] % 8 == 0) {
std::cout << "T" << std::endl;
}
std::cout << "F" << std::endl;
}
return 0;
}