题目链接:https://codeforces.com/contest/19/problem/B
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
static const int MAXN=2e3+10;
int n;
long long dp[MAXN*2];
int t[MAXN],c[MAXN];
int main()
{
scanf("%d",&n);int _maxt=0;for(int i=1;i<=n;i++){
scanf("%d%d",&t[i],&c[i]);t[i]++;_maxt=max(_maxt,t[i]);}memset(dp,0x3f,sizeof(dp));dp[0]=0;long long res=0x3f3f3f3f3f3f3f3f;for(int i=1;i<=n;i++)for(int j=_maxt+n;j>=t[i];j--){
dp[j]=min(dp[j],dp[j-t[i]]+c[i]);if(j>=n) res=min(res,dp[j]);}printf("%lld\n",res);return 0;
}