解方程: int arrangeCoins(int n) { long sum = (long)n; return sqrt(sum * 2 + 0.25) - 0.5; } 转载于:https://www.cnblogs.com/willaty/p/8532288.html