동적 기획-추이 공식-오열 공식

3755 단어
제목: n개의 봉투, n통의 편지, 모두 잘못 넣은 경우
#include<stdio.h>
long long F[21];
int main(){
	F[1]=0;
	F[2]=1;
	for(int i=3;i<=21;++i){
		F[i]=(i-1)*F[i-1]+(i-2)*F[i-2];
	}
	int n;
	while((scanf("%d",&n))!=EOF){
		printf("%lld
"
,F[n]); } return 0; }

좋은 웹페이지 즐겨찾기