result = n % 3; if( result < 0 ) result += 3;. Don't perform extra mod operations as suggested in the other answers.
確定! 回上一頁