c++哪里出错了

#include<bits/stdc++.h>
using namespace std;
long long js(long long);
int n;
long long sum=0;
int main()
{
cin>>n;
for(int i=1;1<=n;i++)
sum+=js(i);
cout<<sum<<endl;
return 0;
}
long long js(int n)
{
long long s=1;
for(int i=1;i<=n;i++)
s*=i;
return s;
}
openjudge中‘求10000以内n的阶乘’

幕布斯7119047
浏览 655回答 1
1回答

慕婉清6462132

#include<bits/stdc++.h>using namespace std;long long js(long long);int n;long long sum=0;int main() {&nbsp; cin>>n;&nbsp; for ( int i=1;1<=n;i++ )&nbsp; sum+=js((long long)i);&nbsp; cout<<sum<<endl;&nbsp; return 0;}long long js(long long n) { long long s=1;&nbsp; for ( int i=1;i<=n;i++ ) s*=i;&nbsp; return s;}追问Time Limit Exceeded!!!
打开App,查看更多内容
随时随地看视频慕课网APP