# LeetCode - 1033. Moving Stones Until Consecutive
### 題目網址:https://leetcode.com/problems/moving-stones-until-consecutive/
###### tags: `LeetCode` `Easy`
```cpp=
/*
-LeetCode format-
Problem: 1033. Moving Stones Until Consecutive
Difficulty: Easy
by Inversionpeter
*/
class Solution {
public:
vector<int> numMovesStones(int a, int b, int c) {
int x = min(min(a, b), c), z = max(max(a, b), c), y = a + b + c - x - z;
return { (x + 2 == y || y + 2 == z) ? 1 : !!(y - x - 1) + !!(z - y - 1), z - x - 2 };
}
};
```