The possibility of performing quantum-chemical calculations using quantum computers has attracted much interest. Variational quantum deflation (VQD) is a quantum-classical hybrid algorithm for the calculation of excited states with noisy intermediate-scale quantum devices. Although the validity of this method has been demonstrated, there have been few practical applications, primarily because of the uncertain effect of calculation conditions on the results. In the present study, calculations of the core-excited and core-ionized states for common molecules based on the VQD method were examined using a classical computer, focusing on the effects of the weighting coefficients applied in the penalty terms of the cost function. Adopting a simplified procedure for estimating the weighting coefficients based on molecular orbital levels allowed these core-level states to be successfully calculated. The O 1s core-ionized state for a water molecule was calculated with various weighting coefficients, and the resulting ansatz states were systematically examined. The application of this technique to functional materials was demonstrated by calculating the core-level states for titanium dioxide (TiO2) and nitrogen-doped TiO2 models. The results demonstrate that VQD calculations employing an appropriate cost function can be applied to the analysis of functional materials in conjunction with an experimental approach.