剩我写的一坨了==
写得非常坎坷
唉
一二三四五
def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) ->
List[List[int]]:
    diff = [0,1,0,-1,0]
    ans = [[rStart,cStart]]
    idx = 0
    while len(ans) < (rows*cols):
        cur_i = idx
        for i in range((cur_i//2+1)):
            rStart += diff[cur_i%4]
            cStart += diff[cur_i%4+1]
            if 0<=rStart<rows and 0<=cStart<cols:
                ans.append([rStart,cStart])
        idx += 1
    return ans