自认为是对的,why RE?
查看原帖
自认为是对的,why RE?
1657498
shixinlei0915楼主2025/2/6 20:55
#include<bits/stdc++.h>
using namespace std;
int ks(int x){
	if(x<=9)return x;
	else {
		x=x%10+x/10%10;
		ks(x);
	}
}
int main(){
	int n;
	cin>>n;
	for(int l=1;l<=n;l++){
		string s;
		cin>>s;
		int a[18];
		int p=0;
		for(int i=s.length()-1;i>=0;i--){
		    a[p]=s[i]-'0';
		    if(i%2==0){
		    	int x=a[p];
		    	x=x*7;
		    	a[p]=ks(x);
			}
			p++;
		} 
		//for(int i=0;i<s.length();i++)cout<<a[i];
		long long t=a[0];
		for(int i=1;i<s.length();i++){
			//cout<<a[i]<<" "<<i<<" ";
			t+=a[i]*pow(10,i);
			//cout<<t<<endl;
		}
		//cout<<t<<endl;
		if(t%8==0)cout<<"T\n";
		else cout<<"N\n";
	}
	return 0;
}
2025/2/6 20:55
加载中...