LeeBlog

导航

HDU 2042 不容易系列之二

 

代码
#include <stdio.h>
#include
<stdlib.h>
void chart ( int ch[] )
{
ch[
0 ] = 3;
for ( int i = 1 ; i < 35 ; ++i )
ch[ i ]
= ( ch[ i - 1 ] - 1 ) * 2;
}
int main ( )
{
int ch[35] = {0},n,N;
chart ( ch );
while ( scanf ( "%d",&N ) == 1 )
while ( N-- )
{
scanf (
"%d" , &n );
printf (
"%d\n" , ch[n] );
}
return 0;
}

 

 

果断打表

 

posted on 2011-01-27 15:34  LeeBlog  阅读(186)  评论(0编辑  收藏  举报