Some supernovae (SNe) are powered by the collision of the SN ejecta with dense circumstellar matter (CSM). Their emission spectra show characteristic line shapes of combined broad emission and narrow P Cygni lines, which should closely relate to the CSM structure and the mass-loss mechanism that creates the dense CSM. We quantitatively investigate the relationship between the line shape and the CSM structure by Monte Carlo radiative transfer simulations, considering two representative cases of dense CSM formed by steady and eruptive mass loss. Comparing the Hα emission between the two cases, we find that a narrow P Cygni line appears in the eruptive case but does not appear in the steady case due to the difference in the velocity gradient in the dense CSM. We also reproduce the blueshifted photon excess observed in some Type IIn SNe, which is formed by photon transport across the shock wave, and find the relationship between the velocity of the shocked matter and the amount of blueshift of the photon excess. We conclude that the presence or absence of narrow P Cygni lines can distinguish the mass-loss mechanism and suggest high-resolution spectroscopic observations with λ/Δλ ≳ 104 after the light-curve peak for applying this diagnostic method.