首页 > TAG信息列表 > 2431

BZOJ 2431 [HAOI2009]逆序对数列 (dp)

题意 问长度为n的1~n的排列,且逆序对为k的方案数有多少 \(n,k\leq 1000\) 思路 假设前\(1\)~\(i\)已经排列好,此时逆序对为\(k\),那么我们来讨论插入\(i+1\)时候的状态 \(i+1\)根据插入位置的不同,可以产生\(0\)到\(i\)个逆序对 根据这个特点我们设\(dp[i][j]\)为前\(i\)个数,逆序对为

POJ 2431 (优先队列)

题目链接:https://vjudge.net/problem/POJ-2431   思路:   “ 在卡车行驶途中, 只有经过加油站才能加油。” 我们不妨转变思路, 理解成“当卡车驶过加油站时就获得了加油的权利”,在之后需要加油时, 就认为是在之前经过加油站时加的油即可。   那么我们何时加油呢, 最好的办法当然是

Expedition---POJ - 2431

A group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck's fuel tank. The truck now leaks one unit of fuel every unit of di