melttt 2016-03-15 13:14 采纳率: 50%
浏览 1121

这个可以精确e的1000次代码的算法是什么意思

int main()
{
    const int N = 1000;
    int a[N];
    int s = 1;
    for (int n = N; n >= 1; --n)
    {
        int r = s % n;
        s = s / n + 1;
        for (int i = 0; i < N; ++i)
        {
            r = r * 10 + a[i];
            a[i] = r / n;
            r %= n;
        }
        for (int i = N - 1; i > 0; --i)
        {
            a[i - 1] += a[i] / 10;
            a[i] %= 10;
        }
        s += a[0] / 10;
        a[0] %= 10;
    }
    printf("%d.", s);
    for (int i = 0; i < N; ++i)
        printf("%d", a[i]);
    printf("\n");

    return 0;

}

  • 写回答

1条回答 默认 最新

  • mianbaohebg 2016-12-17 15:04
    关注

    error reading the project file or the SLD configuration
    各位大神 http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial#QGIS-Server-configuration
    我按照链接的步骤 安装了OsGeo4W-Installer 用Windows7 系统
    appache 安装似乎不正确,因为链接不

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog