按照题意求解即可
class Solution { public: int arrangeCoins(int n) { int i=1; long long sum = 0; while(sum+i<=n)sum += i, ++i; return i-1; } };