九度教程第34题
C语言地址:[cpp]#include<stdio.h>#include<math.h>int depth(int n){return (int)(log(n)/log(2));}int main(){int i,n,a[1002],d;while(scanf("%d",&n)!=EOF){for(i=1;i<=n;i++)scanf("%d",&a[i]);scanf("%d",&d);if(d<depth(n)+1){i=(int)pow(2,d-1);while(i<((int)pow(2,d)-1))printf("%d ",a[i++]);printf("%d\n",a[i]);}elseif(d==depth(n)+1){i=(int)pow(2,d-1);while(i<n)printf("%d ",a[i++]);printf("%d\n",a[i]);}elseprintf("EMPTY\n");}}
补充:软件开发 , C++ ,