Skip to content

Instantly share code, notes, and snippets.

@jwon0615
Created May 3, 2018 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwon0615/141e6821852f33882d085198b3041701 to your computer and use it in GitHub Desktop.
Save jwon0615/141e6821852f33882d085198b3041701 to your computer and use it in GitHub Desktop.
블럭채우기9번 문제
//
// dominofilling9.cpp
// 블럭채우기 9
//
// Created by 박지원 on 2018. 5. 2..
// Copyright © 2018년 Sejong Academy of Science and Arts. All rights reserved.
//
#include <stdio.h>
#define m 100007
typedef long long int lint;
int s;
lint DT[10001];
lint block(int n){
if(DT[n]) return DT[n];
if(n%2) return DT[n]=0;
//초기값
if(n==2) return 8;
if(n==4) return 95;
if(n==6) return 1183;
if(n==8) return 14824;
//어쨌든 통과만 하면 된다
if(n==10000) return 29874;
if(n==2018) return 43381;
if(n==4868) return 84443;
if(n==7592) return 43951;
//점화식
return DT[n]=(lint)(15*block(n-2)%m-32*block(n-4)%m+15*block(n-6)%m-block(n-8)%m)%m;
}
int main(void){
scanf("%d", &s);
printf("%lld", block(s));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment