求调,必关!!
  • 板块题目总版
  • 楼主stu_zzxuan
  • 当前回复4
  • 已保存回复4
  • 发布时间2025/1/5 12:25
  • 上次更新2025/1/5 18:06:15
查看原帖
求调,必关!!
1580942
stu_zzxuan楼主2025/1/5 12:25

#include <bits/stdc++.h> using namespace std; int n; int a, b, s, g, t; int main() { cin >> n; for(int i = 1; i <= n; i++){ cin >> a; t = a; while(t){ t /= 10; ++g; } while(t){ b = t % 10; s += pow(b, g); t /= 10; } if(s == t){ cout << 'T' << '\n'; } else if(s != t){ cout << 'F' << '\n'; } g = 0; s = 0; } return 0;

#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, s, g, t; 
int main()
{	
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a;
		t = a;
		while(t){
			t /= 10;
			++g;
		}
		while(t){
			b = t % 10;
			s += pow(b, g);
			t /= 10;
		}
		if(s == t){
			cout << 'T' << '\n';
		}
		else if(s != t){
			cout << 'F' << '\n';
		}
		g = 0;
		s = 0;
	}
	return 0;
}
2025/1/5 12:25
加载中...