Merge pull request #210 from Hasaki1997/patch-1

修正笔误
This commit is contained in:
CyC2018 2018-04-18 13:19:03 +08:00 committed by GitHub
commit d1687d819f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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