1 static int wing=[]() 2 { 3 std::ios::sync_with_stdio(false); 4 cin.tie(NULL); 5 return 0; 6 }(); 7 8 class Solution 9 { 10 public: 11 int arrangeCoins(int n) 12 { 13 return sqrt((long long)n*2+0.25)-0.5; 14 } 15 };
直接数学公式解题