modifiy Q112/main.c and optimize the efficiency