For any positive integer N,we clearly describe all finite-dimensional algebras A such that the upper triangular matrix algebras TN(A) are piecewise hereditary.Consequently,we describe all finite-dimensional algebras A such that their derived categories of N-complexes are triangulated equivalent to derived categories of hereditary abelian categories,and we describe the tensor algebras A (×) K[X]/(XN) for which their singularity categories are triangulated orbit categories of the derived categories of hereditary abelian categories.