30分,求大佬
查看原帖
30分,求大佬
988486
clx528716楼主2024/12/22 11:09
#include<bits/stdc++.h>
using namespace std;
long long n,x;
int sumf(long long x){
    int sum=0;
    while(x!=0)
    {
        sum+=x%10;
        x/=10;
    }
    return sum;
}
long long fun(long long x)
{
    int a[20],c=1;
    while(x!=0){
        a[c]=x%10;
        c++;
        x/=10;
    }
    for(int i=1;i<c;i++){
        if(i%2!=0)
        {
            a[i]=a[i]*7;
            while(a[i]>9){
                a[i]=sumf(a[i]);
            }
        }
    }
    int t=1;
    x=0;
    for(int i=1;i<c;i++){
        x+=a[i]*t;
        t*=10;
    }
    return x;
}
int main(){
    cin>>n;
    while(n--){
        cin>>x;
        x=fun(x);
        if(sumf(x)%8==0)cout<<"T"<<endl;
        else cout<<"F"<<endl;
    }
    return 0;
}
2024/12/22 11:09
加载中...