Accepted
代码
import java.util.*;
public class Main {
public int Moneycount(int k){
int ans=0;
int temp=0;
int i;
for ( i=0;i<k;i+=++temp){
ans+=(temp*temp);
}
ans+=((k-i+temp)*temp);
return ans;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int k = in.nextInt();
Main k1=new Main();
System.out.println(k1.Moneycount(k));
}
}