jzoj 2542. 【NOIP2011模拟9.1】统计
2016-08-11 16:54
375 查看
题目描述
对于排列(P1,P2,…,PN),定义(i,j)为逆序对当且仅当i < j且Pi > Pj。统计{1,2,…,N}的所有排列中,逆序对数量为M的排列数量。输入
输入文件count.in第一行包含两个正整数N,M。输出
输出文件count.out应包含一个整数,表示满足条件的排列数除以124567的余数。思路
找规律,得出a[i,j]:=a[i−1,j]+a[i,j−1]−a[i−1,j−i](i<j)var n,m,i,j:longint; a:array [0..1001,0..1001] of longint; begin readln(n,m); a[1,1]:=1; for i:=2 to n do for j:=1 to m+1 do if j<=i then a[i,j]:=(a[i-1,j]+a[i,j-1]) mod 124567 else a[i,j]:=(a[i-1,j]+a[i,j-1]-a[i-1,j-i]+124567) mod 124567; write(a[n,m+1]); end.
相关文章推荐
- 2542. 【NOIP2011模拟9.1】统计 (StandardIO)
- jzoj 2541. 【NOIP2011模拟9.1】方格取数
- 【NOIP2011模拟9.1】统计 (Standard IO)
- jzoj 2543. 【NOIP2011模拟9.1】直角三角形
- JZOJ8.11(C组)【NOIP2011模拟9.1】方格取数 (Standard IO)
- 【模拟】[NOIP2011普及组]统计单词数
- 2541. 【NOIP2011模拟9.1】方格取数 (StandardIO)
- noip2011 统计单词数 (模拟)
- JZOJ 5230. 【NOIP2017模拟A组模拟8.5】队伍统计
- JZOJ5230. 【NOIP2017模拟A组模拟8.5】队伍统计
- jzoj 2567. 【NOIP2011模拟9.17】电话时间
- jzoj 2544. 【NOIP2011模拟9.3】作弊的发牌者
- jzoj 2553. 【NOIP2011模拟9.7】射命丸文
- {题解}[jzoj2563]【NOIP2011模拟9.15】区间运算
- Jzoj 2555. 【NOIP2011模拟9.7】雾雨魔理沙
- 【模拟】[NOIP2011普及组]统计单词数
- 【NOIP2011模拟9.1】方格取数 (Standard IO)
- 【NOIP2011模拟9.20】统计方案
- jzoj 2545. 【NOIP2011模拟9.3】跳舞
- JZOJ 5230. 【NOIP2017模拟A组模拟8.5】队伍统计