This commit is contained in:
CyC2018
2018-04-18 13:49:15 +08:00
5 changed files with 6 additions and 2 deletions

View File

@ -127,7 +127,7 @@ public int arrangeCoins(int n) {
int l = 0, h = n;
while(l <= h){
int m = l + (h - l) / 2;
long x = m * (m + 1L) / 2;
long x = m * (m + 1) / 2;
if(x == n) return m;
else if(x < n) l = m + 1;
else h = m - 1;