The formation of the massive young stars surrounding SgrA* is still an open question. In this paper, we simulate the infall of a turbulent molecular cloud towards the Galactic Center (GC). We adopt two different cloud masses (4.3x10^4 and 1.3x10^5 solar masses). We run five simulations: the gas is assumed to be isothermal in four runs, whereas radiative cooling is included in the fifth run. In all the simulations, the molecular cloud is tidally disrupted, spirals towards the GC, and forms a small, dense and eccentric disk around SgrA*. With high resolution simulations, we follow the fragmentation of the gaseous disk. Star candidates form in a ring at ~0.1-0.4 pc from the super-massive black hole (SMBH) and have moderately eccentric orbits (~0.2-0.4), in good agreement with the observations. The mass function of star candidates is top-heavy only if the local gas temperature is high (>~100 K) during the star formation and if the parent cloud is sufficiently massive (>~10^5 solar masses). Thus, this study indicates that the infall of a massive molecular cloud is a viable scenario for the formation of massive stars around SgrA*, provided that the gas temperature is kept sufficiently high (>~100 K).