✔ 最佳答案
Fix a row in your table (i.e. fix x), then this row has all 0,1,2,,,7 if b,2b,3b...8b has all 8 different remainders (then ax+by (a,x fixed, only y change) will also cover 8 different remainder).
From number theory this is true if and only if (b,8) is relatively prime, i.e. b=1,3,5,7. So there are 4 ways. (or you can just write out every value and check directly.)
Similarly, fix column, we see that a=1,3,5,7.
So the number of ways will be 4*4 = 16.