? • 1个月前
using namespace std; long long n = 0,val,idx = 1,S; int f1(int x){
int s = 0;
x*=7;
if(x<=9)return x;
while (x > 9){
while(x){
s += x % 10;
x/=10;
}
x = s;
s = 0;
}
return x;
} int main(){
cin >> n;
int a = 0;
for(int i = 1;i<= n;i++){
cin >> val;
long long tmp = val;
S = 0;
idx = 1;
while(tmp>0){
if(idx%2){
a = f1(tmp %10);
val -=(tmp %10)*pow(10,idx-1);
val += a*pow(10,idx-1);
S += a;
// cout << tmp%10<<endl;
// cout << a << endl;
}
if(idx %2 == 0)
S += tmp%10;
tmp /= 10;
idx++;
}
// cout << val << endl;
if(S%8 == 0)printf("T\n");
else printf("F\n");
}
return 0;
} 不用谢
评论:
请先登录,才能进行评论