?? 開心的金明.cpp
字號:
#include <iostream>
using namespace std;
int main(){
const int M = 30, N = 30009;
int n, m, f[N]={0}, i, j, value, price;
cin >>n >>m;
for( i=0; i<m; ++i ){
cin >>price >>value;
value *= price;
for( j=n; j>=price; --j )
if( f[j-price] + value > f[j] ) f[j] = f[j-price] + value;
}
cout <<f[n] <<endl;
system( "pause" );
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -