题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1000
神题
代码如下:
1 #include <cstdio> 2 #define _______ int 3 #define ________ while 4 #define _________ return 5 #define ___________ if 6 #define ____________ else 7 #define _____________ printf 8 #define ______________ "%d " 9 #define _______________ "%d %d" 10 #define ________________ ~scanf 11 #define _________________ main 12 #define __________________ , 13 #define ___________________ 1 14 #define $ = 15 #define $_$ == 16 17 // Please input two numbers (devided with a space) while you run it. 18 _______ _ __________________ __; 19 20 _______ ______(_______ _ __________________ _______ __) { 21 _______ ____ $ _ ^ __; 22 _______ ___ $ _ & __; 23 ________(___) { 24 _______ _____ $ ____; 25 _______ __________ $ ___ << ___________________; 26 ____ $ _____ ^ __________; 27 ___ $ _____ & __________; 28 } 29 _________ ____; 30 } 31 32 _______ ____(_______ ___) { 33 ___________(___ $_$ _) _________ ___________________; 34 ____________ _________ ______(____(______(___ __________________ ___________________)) 35 __________________ ___________________); 36 } 37 _______ _____(_______ ___) { 38 ___________(___ $_$ __) _________ ___________________; 39 ____________ _________ ______(_____(______(___ __________________ ___________________)) 40 __________________ ___________________); 41 } 42 43 44 _______ _________________() { 45 ________(________________(_______________ __________________ &_ __________________ &__)) 46 _____________(______________ __________________ ______(____(___________________) 47 __________________ _____(___________________))); 48 }
(原版)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <cstdio> 2 3 int a, b; 4 5 int C(int x, int y) { 6 int xr = x ^ y; 7 int nd = x & y; 8 while(nd) { 9 int xr1 = xr; 10 int nd1 = nd << 1; 11 xr = xr1 ^ nd1; 12 nd = xr1 & nd1; 13 } 14 return xr; 15 } 16 17 int A(int c) { 18 if(c == a) { 19 return 1; 20 } 21 else { 22 return C(A(C(c, 1)), 1); 23 } 24 } 25 int B(int c) { 26 if(c == b) { 27 return 1; 28 } 29 else { 30 return C(B(C(c, 1)), 1); 31 } 32 } 33 34 35 int main() { 36 while(~scanf("%d %d", &a, &b)) { 37 printf("%d ", C(A(1), B(1))); 38 } 39 }
然后TLE了