-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.cpp
More file actions
35 lines (34 loc) · 688 Bytes
/
Test.cpp
File metadata and controls
35 lines (34 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <vector>
#include <iostream>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <bitset>
#include <string>
#include <climits>
#include <sstream>
#include <unordered_map>
#include <fstream>
#include <unordered_set>
#include <map>
using namespace std;
int get(int n){
if (n < 7) return n;
vector<int> dp(n+1,0);
for (int i = 0 ; i < 7 ; i++){
dp[i] = i ;
}
for (int i = 7 ; i <= n ; i++){
for (int j = 7 ; j >=3; j-- ){
dp[i] = max(dp[i-j]*(j-1),dp[i]);
}
}
return dp[n];
}
int main(int argc, char const *argv[]) {
int x;
while(cin>>x){
cout<<get(x)<<endl;
}
return 0;
}