关于pow
  • 板块灌水区
  • 楼主zunfxsinw
  • 当前回复12
  • 已保存回复12
  • 发布时间2022/6/5 18:34
  • 上次更新2023/10/27 23:55:27
查看原帖
关于pow
351239
zunfxsinw楼主2022/6/5 18:34
#include <bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long n = 304509,p = 54,ans;
    ans = pow(2,54) - n;
    cout << ans;
    return 0;
}

输出为:18014398509177476 是错的

而改为

#include <bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long n = 304509,p = 54,ans;
    ans = pow(2,54);
    cout << ans - n;
    return 0;
}

输出为:18014398509177475 就对了

能不能告告我为啥

2022/6/5 18:34
加载中...