Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- typedef long double LD;
- typedef pair<LL,LL> PLL;
- typedef pair<LD,LD> PDD;
- typedef pair<int,int> PII;
- typedef pair<PII,PII> PPII;
- #define B_E(a) a.begin(), a.end()
- #define PB push_back
- #define MP make_pair
- #define S second
- #define F first
- inline void file() {
- #ifdef _WIN32
- srand(time(NULL));
- return;
- #endif
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- if (1) {
- freopen("ribbon.in", "r", stdin);
- freopen("ribbon.out", "w", stdout);
- }
- }
- const clock_t MAXT = (100*CLOCKS_PER_SEC)/1000;
- const int PX[8] = {1,0,-1,0, 1,1,-1,-1},
- PY[8] = {0,1,0,-1, -1,1,1,-1},
- N = 2e3 + 10,
- INF = 1e9,
- MOD = 1e9 + 7;
- const LL INFL = 1e18,
- MODL = 1e9 + 7;
- const LD EPS = 1e-9;
- inline int rnd(int l = 0, int r = INF) {
- unsigned ans = rand();
- ans = (ans<<8) ^ rand();
- ans = (ans<<8) ^ rand();
- ans = (ans<<8) ^ rand();
- ans %= r-l+1;
- return int(ans + l);
- }
- int n,a,b,c,res;
- main()
- { file();
- cin>>n>>a>>b>>c;
- res = 1;
- for (int x=0; x*a<=n; ++x)
- for (int y=0; y*b+x*a<=n; ++y) {
- int z = n - x*a - y*b;
- /// x,y,z - коэфициенты, которые определяют вхождение
- /// каждой части строчки в итоговую
- if ( !(z%c) ) {
- z /= c;
- /// x*a + y*b + z*c == n
- if ( res < x+y+z )
- res = x+y+z;
- }
- }
- cout<<res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement