swap的三种写法 void swap1(int &a,int &b){ int t=a; a=b; b=t;}void swap2(int &a,int &b){ a=a^b; b=a^b; a=a^b;}void swap3(int *a,int *b){ *a=*a+*b; *b=*a-*b; *a=*a-*b;} 算法 2023-06-25 45 点赞 0 评论 68 浏览