C++20fen求助
查看原帖
C++20fen求助
1125478
PeppaYang楼主2024/9/17 18:12

救救我

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
long long n,cnt,m,a[N],w;
long long wei(int s){
	long long ans=0;
	while(s){
		ans+=s%10;
		s/=10;
	}
	return ans;
}
void fen(int s){
	w=0;
	while(s){
		a[++w]=s%10;
		s/=10;
	}
	return ;
}
void he(){
	for(int i=w;i>=1;i--){
		cnt+=a[i];
		cnt*=10;            
	}
	cnt/=10;
	return ;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>m;
		fen(m);
		w--;
		for(int j=1;j<=w;j+=2){
			int cc=a[j]*7;
			if(cc>9){
				while(cc>9){
					cc=wei(cc);
				}
			}
			a[j]=cc;
		}
		cnt=0;
		he();
		if(cnt%8==0){
			cout<<"T\n";
		}
		else{
			cout<<"F\n";
		}
	}
	return 0;
} 
2024/9/17 18:12
加载中...