CF888D.Almost Identity Permutations

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A permutation pp of size nn is an array such that every integer from 11 to nn occurs exactly once in this array.

Let's call a permutation an almost identity permutation iff there exist at least nkn-k indices ii ( 1<=i<=n1<=i<=n ) such that pi=ip_{i}=i .

Your task is to count the number of almost identity permutations for given numbers nn and kk .

输入格式

The first line contains two integers nn and kk ( 4<=n<=10004<=n<=1000 , 1<=k<=41<=k<=4 ).

输出格式

Print the number of almost identity permutations for given nn and kk .

输入输出样例

  • 输入#1

    4 1
    

    输出#1

    1
    
  • 输入#2

    4 2
    

    输出#2

    7
    
  • 输入#3

    5 3
    

    输出#3

    31
    
  • 输入#4

    5 4
    

    输出#4

    76
    
首页