3 条题解

  • 0
    @ 2026-3-7 13:07:09
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e3+10;
    int n;
    long long h;
    int ac(int y,int x){
    	if(x%2==0)
            return y;
        y*=7;
        while(y>9){
            int temp=y,cnt=0;
            while(temp!=0){
                cnt+=temp%10;
                temp/=10;
            }
            y=cnt;
        }
        return y;
    }
    bool AC(long long x){
    	long long sum=0,i=1;
    	while(x!=0){
            sum+=ac(x%10,i);
            x/=10;
            i++;
    	}
    	if(sum%8==0)
    	    return true;
    	else return false;
    }
    int main()
    {
        cin>>n;
        for(int i=0;i<n;i++){
        	cin>>h;
        	if(AC(h))
        	    cout<<'T'<<endl;
        	else cout<<'F'<<endl;
    	}
    	return 0;
    }
    
    • -1
      @ 2026-5-1 11:29:10
      #define LL long long
      using namespace std;
      
      int get_single(int x){
          while(x>9){
              int sum=0;
              while(x){
                  sum+=x%10;
                  x/=10;
              }
              x=sum;
          }
          return x;
      }
      
      bool check(LL num){
          vector<int> digits;
          while(num){
              digits.push_back(num%10);
              num/=10;
          }
          int total=0;
          for(int i=0;i<digits.size();i++){
              int pos=i+1;
              int d=digits[i];
              if(pos%2==1){
                  int val=d*7;
                  val=get_single(val);
                  total+=val;
              }else{
                  total+=d;
              }
          }
          return total%8==0;
      }
      
      int main(){
          int N;
          cin>>N;
          while(N--){
              LL x;
              cin>>x;
              if(check(x)) cout<<"T"<<endl;
              else cout<<"F"<<endl;
          }
          return 0;
      }
      //:)
      //114514
      
      

      click to my bilibili

      • -1
        @ 2026-5-1 11:27:56

        ***```language #include <bits/stdc++.h> #define LL long long using namespace std;

        int get_single(int x){ while(x>9){ int sum=0; while(x){ sum+=x%10; x/=10; } x=sum; } return x; }

        bool check(LL num){ vector digits; while(num){ digits.push_back(num%10); num/=10; } int total=0; for(int i=0;i<digits.size();i++){ int pos=i+1; int d=digits[i]; if(pos%21){ int val=d*7; val=get_single(val); total+=val; }else{ total+=d; } } return total%80; }

        int main(){ int N; cin>>N; while(N--){ LL x; cin>>x; if(check(x)) cout<<"T"<<endl; else cout<<"F"<<endl; } return 0; } //:) //114514

        • 1

        信息

        ID
        3456
        时间
        1000ms
        内存
        256MiB
        难度
        6
        标签
        递交数
        47
        已通过
        16
        上传者