Delay-tolerant networks are novel wireless mobile networks, which are characterized with high latency and frequent disconnectivity. Besides, people carrying mobile devices form a lot of communities because of similar interests and social relationships. How to improve the routing efficiency in multi-community scenarios has become one of the research hot spots in delay-tolerant networks. In this article, we present a network model of the multi-community delay-tolerant networks and formulate a dynamic quota-controlled routing problem of minimizing the average number of copies of a message that satisfies the required delivery probability under the given time-to-live of the message as a nonlinear optimization problem. To solve this problem, we propose an improved genetic algorithm called genetic algorithm for delivery probability and time-to-live optimization for the dynamic quota-controlled routing scheme to reduce the routing cost further. In addition, a cost-efficient dynamic quota-controlled routing protocol based on genetic algorithm for delivery probability and time-to-live optimization is proposed, which can dynamically adjust message copies according to its assigned delivery probability and time-to-live in different communities on the shortest path. Both the numerical and simulation results show that our routing with the proposed algorithm is more cost efficient.