为啥会WA两个点

P2669 [NOIP2015 普及组] 金币

wuyou03 @ 2017-09-14 12:57:32

#include<cstdio>
#include<cmath>
using namespace std;
int k,d;
int main(){
    scanf("%d",&k);
    d=sqrt(2*k);
    printf("%d",d*(d+1)*(2*d+1)/6+(k-(1+d)*d/2)*(d+1));
}

by Dr_殇 @ 2017-09-14 13:13:49

d=(sqrt(8*k+1)-1)/2;


|