[BOJ] 1720 타일 코드

Time Lapse :NONE

1720.c

1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
long tiles[31] = {1, 1};
int N;
int main() {
for(int i = 2; i <= 30; ++i)
tiles[i] = tiles[i-1] + (tiles[i-2]<<1);
scanf("%d",&N);
printf("%ld",N&1 ? (tiles[N]+tiles[N>>1])>>1 : (tiles[N]+tiles[N>>1]+(tiles[(N>>1)-1]<<1))>>1);

}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/BOJ/1720/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.