Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int a[140][140];
- int e1=0,e2=0,i,j,x,N;
- cin » N;
- for(i=0;i<140;i++)
- for(i=0;i<140;i++)
- a[i][j]=0;
- for(i=0;i<N;i++){
- cin » x;
- if(x%7==0)
- if(x+a[0][x%140]>e1+e2 && a[0][x % 140] != 0){
- e1=a[0][x%140];
- e2=x;
- }
- else if(x+a[1][x%140]>e1+e2 && a[1][x % 140] != 0){
- e1=a[1][x%140];
- e2=x;
- }
- if(x%7==0){
- for(j=0;j<140;j++){
- if(x%140!=j)
- if(x>a[1][j])
- a[1][j]=x;
- }
- }
- else{
- for(j=0;j<140;j++){
- if(x%140!=j)
- if(x>a[0][j])
- a[0][j]=x;
- }
- }
- }
- cout « e1 « " "« e2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement