70pts 求调orz
查看原帖
70pts 求调orz
907113
Bug_Hunter楼主2024/4/4 08:57
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll t,n,cnt,s[20];
ll turn(ll x,ll a,ll b){
	if(a==0) return x/s[b];
	ll sum=x%s[a-1]+x/s[b]*s[a-1];
	return sum;
}
bool check(ll x){
	for(ll l=0;x/s[l]>0;l++){
		for(ll r=l;x/s[r]>0;r++){
			if(turn(x,l,r)%4==0) return 1;
		}
	}
	return 0;
}
int main(){
	s[0]=1;
	for(ll i=1;i<=18;i++) s[i]=s[i-1]*10;
	cin>>t;
	while(t--){
		cin>>n;
		if(check(n)) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}
2024/4/4 08:57
加载中...