程序(题目:B3841):
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t,n,len,t1,t2;
for(cin >> t;t;--t)
{
cin >> n,len = to_string(n).length(),t1 = n,t2 = 0;
for(register int i(1);i <= len;++i) t2 += pow(t1%10,len),t1 /= 10;
cout << (n == t2?"T\n":"F\n");
}
}
输入:
3
152
111
153
本地输出(-std=c++14 -O2):
F
F
F
不知道为什么,本地 27+125 的结果是 151
在洛谷在线 IDE 运行的输出:
这个输出是正常的
F
F
T
在洛谷上 AC 了,但不太理解为什么本地输入样例会有问题