欢迎使用本站,预祝练习时长两年半的选手们到成功! [本模块信息来自tem/def/head]

B3850 幸运数

时间:2024-05-13 13:18 作者:admin 点击:
#include iostream#include algorithmusing namespace std;int main(){ long long n,m,s=0,t; cinn; while(n--){ s=0; cinm; int i=0; while(m){ i++; if(i%2){ t=m%10*7; while(t9) t=t%10+t/10; } else t=m%10; s+=t; m/=10; } if(s%8==0) cout"T\n"; else
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    long long n,m,s=0,t;
    cin>>n;
    while(n--){
        s=0;
        cin>>m;
        int i=0;
        while(m){
            i++;
            if(i%2){
                t=m%10*7;
                while(t>9) t=t%10+t/10;
            }
            else t=m%10;
            s+=t;
            m/=10;
        }
        if(s%8==0) cout<<"T\n";
        else cout<<"F\n";
    }
    return 0;
}


(责任编辑:admin)
    顶一下
    (0)
    0%
    踩一下
    (0)
    0%