1 //找规律即可,下附打表 2 #include<stdio.h> 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int a,b; 10 scanf("%d%d",&a,&b); 11 printf("%lld ",(long long)1<<(a-b)); 12 } 13 }
1 //打表法 2 #include<stdio.h> 3 long long a[60]; 4 5 void cus(int x,long long y) 6 { 7 if(x>=60) 8 return ; 9 a[x]=y; 10 cus(x+1,y*2); 11 } 12 13 int main() 14 { 15 cus(0,1); 16 int n; 17 scanf("%d",&n); 18 while(n--) 19 { 20 int b,c; 21 scanf("%d%d",&b,&c); 22 printf("%lld ",a[b-c]); 23 } 24 }