标签:blog io sp div log bs amp as tt
#include <stdio.h> #include <math.h> int main(void) { int a, b, t; scanf("%d%d", &a, &b); /* 方法一:三变量法 t = a; a = b; b = t; 方法二: a = a - b; b = a + b; a = b - a; 方法二变种: a = a + b; b = a - b; a = a - b; */ //方法三:异或运算,原因是对于整形变量a,有a^a=0 a = a ^ b; b = a ^ b; a = a ^ b; printf("%d %d\n", a, b); return 0; }
标签:blog io sp div log bs amp as tt
原文地址:http://www.cnblogs.com/xpjiang/p/4085968.html