Advertisement
vafin20

Untitled

Jul 2nd, 2020
1,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int a[140][140];
  6. int e1=0,e2=0,i,j,x,N;
  7. cin » N;
  8. for(i=0;i<140;i++)
  9. for(i=0;i<140;i++)
  10. a[i][j]=0;
  11. for(i=0;i<N;i++){
  12. cin » x;
  13. if(x%7==0)
  14. if(x+a[0][x%140]>e1+e2 && a[0][x % 140] != 0){
  15. e1=a[0][x%140];
  16. e2=x;
  17. }
  18. else if(x+a[1][x%140]>e1+e2 && a[1][x % 140] != 0){
  19. e1=a[1][x%140];
  20. e2=x;
  21. }
  22. if(x%7==0){
  23. for(j=0;j<140;j++){
  24. if(x%140!=j)
  25. if(x>a[1][j])
  26. a[1][j]=x;
  27. }
  28. }
  29. else{
  30. for(j=0;j<140;j++){
  31. if(x%140!=j)
  32. if(x>a[0][j])
  33. a[0][j]=x;
  34. }
  35. }
  36. }
  37. cout « e1 « " "« e2;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement