Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 100;
- int C[4] = {0, 6, 9, 20};
- bool dp[4][N + 1];
- int main(){
- for(int i = 0; i <= 3; ++i){
- dp[i][0] = true;
- }
- for(int i = 1; i <= 3; ++i){
- for(int x = 0; x <= N; ++x){
- if(x >= C[i]){
- dp[i][x] |= dp[i][x - C[i]];
- }
- dp[i][x] |= dp[i - 1][x];
- }
- }
- int x;
- scanf("%d", &x);
- if(x < 6){
- cout << "no";
- return 0;
- }
- for(int i = 1; i <= x; ++i){
- if(dp[3][i]){
- cout << i << '\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement