#include
#include
#include
#include
#include
#include
using namespace std;
short int num[101];
int sum[101];
short int price[101];
int res[101];
int main()
{
int m,n,u,v,tmp;
cin>>m;
for(int i=0;i {
cin>>n;
memset(num,0,sizeof(num));
memset(price,0,sizeof(price));
memset(sum,0,sizeof(sum));
sum[0]=0;
res[0]=0;
for(int j=1;j<=n;j++)
{
res[j] = INT_MAX;
cin>>num[j]>>price[j];
sum[j]= sum[j-1]+num[j];
}
for(u=1;u<=n;u++) //关态转移方程为a[u] = min{a[k]+(sum[u]-sum[k]+10)*price[u]}(1= for(v=u-1;v>=0 ;v--)
{
res[u] = min(res[u], res[v]+(sum[u]-sum[v]+10)*price[u] );
}
cout< }
return 0;
}
阅读(736) | 评论(0) | 转发(0) |