社区讨论
为什么只得了15分?求解
B3841[GESP202306 二级] 自幂数判断参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mhjsqx76
- 此快照首次捕获于
- 2025/11/04 07:54 4 个月前
- 此快照最后确认于
- 2025/11/04 07:54 4 个月前
CPP
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int n ,sum = 0,a,b;
int x = 0, k;
cin >> n;
for (int i = 1;i <= n;i++){
cin >> k;
a = k;
b = k;
while (k){
k /= 10;
++x;
}
while (a){
int t = a % 10;
sum =sum + pow (t, x);
a /= 10;
}
if(sum == b){
cout << "T"<<endl;
}
else{
cout << "F"<<endl;
}
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...