It is impossible to use only one kind of weight, so we should use both. First of all, consider the number of 23 grams of weights, set it as X, 5 grams of weights as Y, {then 23x=5y plus or minus 4.
So the mantissa of 23x must be one of 1, 4, 6, 9.
So the mantissa of x must be one of 2, 3, 7 and 8.
Test in turn from small to large
x=2,y= 10
x=3,y= 13
x=7,....}
It can be seen that with the increase of x, the value of y also increases.
Note {} is a train of thought, which may be helpful to your other similar questions, but this question seems unnecessary.
So at least use the weight of 10+2= 12.