xfstart07
Get busy living or get busy dying

#include < iostream >
using   namespace  std;

int  l[ 3 ],c[ 3 ];
int  n,s,t;
int  a[ 110 ];
int  f[ 110 ];
int  make( int  li){
    
for ( int  i = 0 ;i < 3 ; ++ i)
        
if (li <= l[i])
            
return  c[i];
    
return   - 1 ;
}
int  main()
{
    
for ( int  i = 0 ;i < 3 ; ++ i)
        cin
>> l[i];
    
for ( int  i = 0 ;i < 3 ; ++ i)
        cin
>> c[i];
    cin
>> n >> s >> t;
    
if (s > t){
        
int  tmp = s;
        s
= t;t = tmp;
    }
    a[
1 ] = 0 ;
    
for ( int  i = 2 ;i <= n; ++ i)
        cin
>> a[i];
    
for ( int  i = 1 ;i <= s; ++ i) 
        f[i]
= 0 ;
    
for ( int  i = s + 1 ;i <= t; ++ i){
        f[i]
= 0x7FFFFFFF ;
        
for ( int  j = i - 1 ;j >= s; -- j){
            
int  k = make(a[i] - a[j]);
            
if (k ==- 1 break ;
            
if (f[i] > f[j] + k)
                f[i]
= f[j] + k;
        }
    }
    cout
<< f[t] << endl;
    
return   0 ;
}








posted on 2009-05-01 16:09 xfstart07 阅读(90) 评论(0)  编辑 收藏 引用 所属分类: 代码库

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理