样例没过 C++ 求助
查看原帖
样例没过 C++ 求助
632830
Mark_666楼主2022/5/18 21:39
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    long long sum=0;
    cin>>n;
    int t=0;
    for(int i=1,j=1;i<=n;i+=t,j++)
    {
    	sum+=j*i;
    	t++;
	}
    cout<<sum<<endl;
    return 0;
}

大佬来看看,哪里错了

2022/5/18 21:39
加载中...