题目链接

https://www.patest.cn/contests/gplt/L1-013

AC代码

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <cstdlib>
#include <ctype.h>
#include <numeric>
#include <sstream>
using namespace std;

typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
double fac(int x)
{
    double sum = 1;
    for (int i = 2; i <= x; i++)
        sum *= i;
    return sum;
}

int main()
{
    int n;
    cin >> n;
    long double sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += fac(i);
    }
    printf("%.0Lf\n", sum);
}

PAT 天梯赛 L1-013. 计算阶乘和 【水】的更多相关文章

  1. PAT 天梯赛 L1-036. A乘以B 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-036 AC代码 #include <iostream> #include <cstdio&g ...

  2. PAT 天梯赛 L1-019. 谁先倒 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-019 AC代码 #include <iostream> #include <cstdio&g ...

  3. PAT 天梯赛 L1-018. 大笨钟 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-018 AC代码 #include <iostream> #include <cstdio&g ...

  4. PAT 天梯赛 L1-026. I Love GPLT 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-026 AC代码 #include <iostream> #include <cstdio&g ...

  5. PAT 天梯赛 L1-037. A除以B 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-037 AC代码 #include <iostream> #include <cstdio&g ...

  6. 天梯赛L1 题解

    L1-001 Hello World (5 分) 这道超级简单的题目没有任何输入. 你只需要在一行中输出著名短句“Hello World!”就可以了. AC代码:(直接输出记性) #include & ...

  7. PAT天梯赛 L1-049 天梯赛座位分配

    题目链接:点击打开链接 天梯赛每年有大量参赛队员,要保证同一所学校的所有队员都不能相邻,分配座位就成为一件比较麻烦的事情.为此我们制定如下策略:假设某赛场有 N 所学校参赛,第 i 所学校有 M[i] ...

  8. PAT天梯赛L3-007 天梯地图

    题目链接:点击打开链接 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校所在地和赛场地点后,该地图应该推荐两条路线:一条是最快到达路线:一条是最短距离的路线.题目保证对任意的查询请求,地图上都至 ...

  9. PAT天梯赛练习题——L3-007. 天梯地图(多边权SPFA)

    L3-007. 天梯地图 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校 ...

  10. PTA 天梯赛 L1

    L1-002 打印沙漏 细节:就是在  (i>j&&i+j<r+1) 这个区间里才有空格,然后就是 for 循环   for(r=1; ;r+=2)  条件不满足之后还会再 ...

随机推荐

  1. Using Fast Weights to Attend to the Recent Past

    Ba, Jimmy, et al. "Using Fast Weights to Attend to the Recent Past." Advances In Neural In ...

  2. (转)java Exception层次结构详解

    转自:http://www.importnew.com/14688.html 1. JAVA异常层次结构 异常指不期而至的各种状况,如:文件找不到.网络连接失败.非法参数等.异常是一个事件,它发生在程 ...

  3. WPFLoading遮层罩

    一直想实现这么个功能来着,所以去网上搜了资料,复杂的看不懂,后来挑了一个最简单的,复用了这位大神的很多代码(大神看到了别打脸).这位大神是用UserControl,使用时则是调用用户控件中的方法.之前 ...

  4. ChemDraw的“键”工具的作用是什么

    ChemDraw的“键”工具在化学研究中能够发挥重大作用,如果你也是一名化学相关工作者就千万不要错过这篇教程,下文详细盘点“键”工具究竟能干些什么. ChemDraw化学软件免费获取地址:http:/ ...

  5. VC++ Debug内存值

    Memory Values If you're using the debug heap, memory is initialized and cleared with special values. ...

  6. poj 2531(dfs)

    题目链接:http://poj.org/problem?id=2531 思路:由于N才20,可以dfs爆搞,枚举所有的情况,复杂度为2^(n). #include<iostream> #i ...

  7. IntelliJ Idea Hide excluded folders 隐藏或显示你需要的文件夹

    IntelliJ Idea,以前用idea时,经常maven编译就出现了exclude下的文件夹通常是target,如何隐藏自己不想看见的文件夹,或显示偶尔会用到的文件夹 点击齿轮右下小标 选中文件夹 ...

  8. Tomcat unable to start within 45 seconds.

    解决的方法当然是设定这个时间,让其大于45秒,修改在当前项目所在的workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xm ...

  9. cxGrid 隔行换色

    新建一个cxStyleRepository,分别建立几种Styles,如cxgrid_odd,cxgrid_even,cxgrid_selection等,并设置好它们的背景色.字体属性等. 在cxGr ...

  10. [Go语言]从Docker源码学习Go——main函数

    Go程序从main包下的main函数开始执行,当main执行结束后,程序退出. Docker的main函数在 docker/docker/docker.go package main //Import ...