Recent advancements in Large Language Models(LLMs) have demonstrated remarkable capabilities in generating problem-solving code directly from natural language descriptions of programming tasks. This ability highlights the potential of LLMs in automated software development. However, in real-world scenarios, user-provided problem descriptions are often incomplete or imprecise, lacking critical details required for accurate code generation. To address this limitation, we leverage the role-playing capability of LLMs and propose a multiagent framework designed to enhance the clarity, accuracy, and robustness of code generation. Our framework employs three specialized agents that collaboratively analyze the programming problem from different perspectives: requirement clarification, solution feasibility assessment, and robustness analysis. Through structured discussion, these agents refine the initial problem description into a collaboratively refined, detailed specification, ensuring comprehensive coverage of functional and nonfunctional requirements. Additionally, the framework incorporates conflict detection to verify that the refined specifications remain consistent with the user's original intent. The finalized detailed description is then passed to programming and testing agents for code generation and validation. We evaluate our framework on the benchmark datasets. The results demonstrate that requirement discussion and conflict detection significantly improve the success rate of code generation over the direct application of initial problem descriptions. Our findings suggest that the proposed multi-agent approach enhances the reliability and practical viability of LLM-based automated programming.