hdu--2563 统计步数(分水平和竖直)

    技术2022-05-19  19

    #include "stdio.h" #include "string.h" #include "stdlib.h" #include "math.h" int main() { int h, m, s, t, n, i,len,temp,j,k,min,min2,make; int x[21],y[21],z[21]; x[1]=2;y[1]=1;z[1]=3; for (i=1;i<20;i++) { x[i+1]=x[i]+2*y[i]; y[i+1]=x[i]+y[i]; z[i+1]=x[i+1]+y[i+1]; } scanf("%d/n",&t); while (t--) { scanf("%d",&n); printf("%d/n",z[n]); } return 0; }


    最新回复(0)