level 11
usrbin
楼主
有下列程序代码:
#include <stdio.h>
int mask = 0,tot = 0;
inline void f(int n){
if(--n) f(n),mask ^= 1 << (n-1),printf("%d %d\n",++tot,mask),f(n);
}
int main(){
int n;
scanf("%d",&n);
f(n);
return 0;
}
===========================================================
给定输入的n值(n∈[1,10^6]),以及某时刻tot值(二进制,mask∈[1,2^(n-1)-1]),输出mask值
样例输入:
4 110
5 1010
样例输出:
101
1111
2011年04月16日 18点04分
1
#include <stdio.h>
int mask = 0,tot = 0;
inline void f(int n){
if(--n) f(n),mask ^= 1 << (n-1),printf("%d %d\n",++tot,mask),f(n);
}
int main(){
int n;
scanf("%d",&n);
f(n);
return 0;
}
===========================================================
给定输入的n值(n∈[1,10^6]),以及某时刻tot值(二进制,mask∈[1,2^(n-1)-1]),输出mask值
样例输入:
4 110
5 1010
样例输出:
101
1111

