We investigate the formation of terrestrial planets in the late stage of planetary formation using two-planet model . At that time , the protostar has formed for about 3 Myr and the gas disk has dissipated . In the model , the perturbations from Jupiter and Saturn are considered . We also consider variations of the mass of outer planet , and the initial eccentricities and inclinations of embryos and planetesimals . Our results show that , terrestrial planets are formed in 50 Myr , and the accretion rate is about 60 % - 80 % . In each simulation , 3 - 4 terrestrial planets are formed inside ” Jupiter ” with masses of 0.15 - 3.6 M _ { \oplus } . In the 0.5 - 4AU , when the eccentricities of planetesimals are excited , planetesimals are able to accrete material from wide radial direction . The plenty of water material of the terrestrial planet in the Habitable Zone may be transferred from the farther places by this mechanism . Accretion may also happen a few times between two giant planets only if the outer planet has a moderate mass and the small terrestrial planet could survive at some resonances over time scale of 10 ^ { 8 } yr .