为什么样例全队,但确WA???
查看原帖
为什么样例全队,但确WA???
1340936
guimei121212楼主2024/8/22 22:32
#include <iostream>
using namespace std;

int main(){
    int n,b;
    bool a=false;
    int num=1;
    long long res=0;
    cin>>n;
    for(int i=1;i<=n;i++){
    	a=false;
    	num=1;
    	res=0;
        cin>>b;
        if(b==1||b==0){
        	cout<<'T';
        	continue;
		}
        for(int k=1;k<=9;k++){
        	res=0;
         for(long long j=1;j<=100000000;j*=10){
         	num=1;
            
                for(int x=1;x<=k;x++){
                    num*=(b/j%10);
            	}
               
       		 
            res+=num;
 
    	}
    		if(res==b){
        		cout<<'T'<<endl;
        		a=true;
			}
    	
    }
    if(a!=true){
    	cout<<'F'<<endl;
	}
       
}
return 0;
}
2024/8/22 22:32
加载中...