这样50分。。。?

P1009 [NOIP1998 普及组] 阶乘之和

zhao_jiang_zi_han @ 2024-09-06 22:01:39

#include<bits/stdc++.h>
using namespace std;

int f(int n)
{
    int s,sum = 0;
    for(int i = 1; i <= n; i++)
    {
        s = 1;
        for(int j = 1; j <= i; j++)
        {
            s *= j;
        }
        sum += s;
    }
    return sum;
}

int main()
{
    int n;
    cin>>n;
    cout<<f(n)<<endl;
}

就这玩意
把之前的程序翻出来在洛谷上交了一下
然后就50分了
感觉很炸裂(?) 有没有大佬来解释一下,本蒟蒻的脑子不太好用
我那么写其实是懒得打高精啦


by zhao_jiang_zi_han @ 2024-09-06 22:02:34

好像也不是很炸裂(?)


by dongzirui0817 @ 2024-09-06 22:07:34

@zhao_jiang_zi_han because 你爆 int


by yaohongjia @ 2024-09-06 22:08:26


by zhao_jiang_zi_han @ 2024-09-06 22:10:47

@dongzirui0817 恍然大悟.exe


|