Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- using namespace std;
- ifstream f("submit.in");
- ofstream g("submit.out");
- #define NMAX 101
- int n,pct[NMAX],bonus,m,p,i,j,complet,crt,maxim;
- int main()
- {
- f>>n;
- for(i=1;i<=n;i++) f>>pct[i];
- f>>bonus;
- f>>m;
- maxim=0;
- for(j=1;j<=m;j++)
- {
- complet=1;
- crt=0;
- for(i=1;i<=n;i++)
- {
- f>>p;
- if(p==0) complet=0;
- else crt+=pct[i];
- }
- if(complet) crt+=bonus;
- crt-=2*(j-1);
- if(crt>maxim) maxim=crt;
- }
- g<<maxim;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement