提交时间:2024-05-27 13:25:54
运行 ID: 149451
# include <bits/stdc++.h> using namespace std ; int sum [101] , p [101] ; int f [101] ; int main ( ) { int n ; cin >> n ; for ( int i = 1 , tmp ; i <= n ; i ++ ) { cin >> tmp >> p [i] ; sum [i] = sum [i - 1] + tmp ; } for ( int i = 1 ; i <= n ; i ++ ) { f [i] = pow ( 2 , 25 ) ; for ( int j = 0 ; j < i ; j ++ ) { f [i] = min ( f [i] , f [j] + ( sum [i] - sum [j] + 10 ) * p [i] ) ; } } cout << f [n] << endl ; return 0 ; }