DEV c++玄学问题
  • 板块学术版
  • 楼主流光萤影
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/9/23 16:42
  • 上次更新2023/11/2 18:30:13
查看原帖
DEV c++玄学问题
552286
流光萤影楼主2023/9/23 16:42

程序(题目:B3841\verb!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\verb!-std=c++14 -O2!):

F
F
F

不知道为什么,本地 27+12527 + 125 的结果是 151151

在洛谷在线 IDE\verb!IDE! 运行的输出:

这个输出是正常的

F
F
T

在洛谷上 AC\verb!AC! 了,但不太理解为什么本地输入样例会有问题

2023/9/23 16:42
加载中...