20分求助
查看原帖
20分求助
924658
bowen114514楼主2024/7/22 09:42
#include<bits/stdc++.h>
using namespace std;
int a[]={9,1,2,3,4,5,6,7,8};
int main()
{
    // freopen("gougu.in","r",stdin);
    // freopen("gougu.out","w",stdout);
    long long T;
    cin>>T;
    while(T--)
    {
        long long x;
        int sum=0;
        cin>>x;
        int i=1;
        long long temp=x;
        while(temp)
        {
            i++;
            temp/=10;
        }
        for(int j=1;j<=i;j++)
        {
            if(j%2)
            {
                int now=x%10;
                x/=10;
                now=a[(now*7)%9];
                sum+=now;
            }
            else
            {
                int now=x%10;
                x/=10;
                sum+=now;
            }
        }
        if(sum%8==0)
        {
            cout<<'T'<<endl;
        }
        else
        {
            cout<<'F'<<endl;
        }
    }
    return 0;
}
2024/7/22 09:42
加载中...