Rev*_*nzo 180
x = 1 - x
Run Code Online (Sandbox Code Playgroud)
将在0和1之间切换.
st0*_*0le 27
编辑:我误解了这个问题,认为OP可以使用any运算符
更多......(忽略这些)
x ^= 1 // bitwise operator
x = !x // logical operator
x = (x <= 0) // kinda the same as x != 1
Run Code Online (Sandbox Code Playgroud)
不使用运营商?
int arr[] = {1,0}
x = arr[x]
Run Code Online (Sandbox Code Playgroud)
MAK*_*MAK 16
另一种方式:
x = (x + 1) % 2
Run Code Online (Sandbox Code Playgroud)
斯托尔第二种方法的喜剧变奏
x = "\1"[x]
Run Code Online (Sandbox Code Playgroud)