Advertisement
a53

submit

a53
Feb 28th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3. using namespace std;
  4. ifstream f("submit.in");
  5. ofstream g("submit.out");
  6. #define NMAX 101
  7. int n,pct[NMAX],bonus,m,p,i,j,complet,crt,maxim;
  8. int main()
  9. {
  10. f>>n;
  11. for(i=1;i<=n;i++) f>>pct[i];
  12. f>>bonus;
  13. f>>m;
  14. maxim=0;
  15. for(j=1;j<=m;j++)
  16. {
  17. complet=1;
  18. crt=0;
  19. for(i=1;i<=n;i++)
  20. {
  21. f>>p;
  22. if(p==0) complet=0;
  23. else crt+=pct[i];
  24. }
  25. if(complet) crt+=bonus;
  26. crt-=2*(j-1);
  27. if(crt>maxim) maxim=crt;
  28. }
  29. g<<maxim;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement