全RE,求debug
查看原帖
全RE,求debug
1038838
张一2010楼主2024/3/16 22:56
#include<bits/stdc++.h>
using namespace std;
int N;string s;
int bh(int a){  //变换
	int b=a%10+a/10;			//cout<<"b:  "<<b<<"\n";
	if(b<10) return b;
	else bh(b);
}

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>s;
		int len=s.size(),pdans=0;
		for(int j=len-1;j>=0;j--){ //cout<<j<<" ";
			int x=s[j]-'0'; 	//cout<<x<<"\n";
			if((len-j+1)%2==1){
				pdans+=x;
				continue;
			}
			if(x*7<10){
				pdans+=x*7;     //cout<<1<<" x*7= "<<x*7<<" pdans: "<<pdans<<"\n";
			}else{
				pdans+=bh(x*7);	//cout<<0<<" bh__x*7= "<<bh(x*7)<<" pdans: "<<pdans<<"\n";
			}
		}
		if(!(pdans%8)) cout<<"T"<<"\n";
		else 	cout<<"F"<<"\n";
	}
	return 0;
}

2024/3/16 22:56
加载中...