1. A device for alternately generating X-rays having different energy levels comprising: a signal generator for generating a signal; a first pulse modulator connected to the signal generator for generating a first pulse voltage and a second pulse voltage; a second pulse modulator connected to the signal generator for generating a third pulse voltage and a fourth pulse voltage which are in synchronization with the first pulse voltage and the second pulse voltage respectively; a grid-controlled electron gun connected to the first pulse modulator for generating a first electron beam having a first beam load and a second electron beam having a second beam load, respectively, based on the first pulse voltage and the second pulse voltage; a magnetron connected to the second pulse modulator for generating a first microwave having a first power and a second microwave having a second power which is different from the first power, respectively, based on the third pulse voltage and the fourth pulse voltage; an acceleration tube connected to the grid-controlled electron gun for receiving the first electron beam and the second electron beam and accelerating the first electron beam and the second electron beam respectively using the first microwave and the second microwave to obtain the accelerated first electron beam and the accelerated second electron beam; and a target to be hit by the accelerated first electron beam and the accelerated second electron beam to generate a first X-ray and a second X-ray having different energy levels.