2 solutions

  • 1
    @ 2025-5-25 13:53:02
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		int x;
    		cin>>x;
    		int t=x;
    		int cnt=0;
    		while(t)
    		{
    			t/=10;
    			cnt++;
    		}
    		int sum=0;
    		t=x;
    		while(t)
    		{
    			int ge=t%10;
    			sum+=pow(ge,cnt);
    			t/=10;
    		}
    		if(sum==x)
    		{
    			cout<<"T"<<endl; 
    		}
    		else
    		{
    			cout<<"F"<<endl;
    		}
    	}
    	return 0;
    }
    
    
    • 0
      @ 2025-4-19 9:49:30
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int n;
      	cin>>n;
      	for(int i=1;i<=n;i++)
      	{
      		int x;
      		cin>>x;
      		int t=x;
      		int cnt=0;
      		while(t)
      		{
      			t/=10;
      			cnt++;
      		}
      		int sum=0;
      		t=x;
      		while(t)
      		{
      			int ge=t%10;
      			int s=1;
      			for(int j=1;j<=cnt;j++)
      			{
      				s=s*ge;
      			}
      			sum+=s;
      			t/=10;
      		}
      		if(sum==x)
      		{
      			cout<<"T"<<endl; 
      		}
      		else
      		{
      			cout<<"F"<<endl;
      		}
      	}
      	return 0;
      }
      
      
      • 1

      Information

      ID
      1176
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      (None)
      # Submissions
      35
      Accepted
      7
      Uploaded By