求大佬

P2669 [NOIP2015 普及组] 金币

飞翔的钰米 @ 2017-06-29 15:52:01

#include<iostream>
using namespace std;
int k,n,ans;
int main()
{
    n=1;
    cin>>k;
    do
    {ans=ans+n*n;
    k=k-n;
    n++;
    }while(k>0);
    cout<<ans;
    return 0;
}

by Wy12121212 @ 2017-07-15 14:12:00

不对


|