Guest User

Untitled

a guest
May 11th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3.  
  4. int main(){
  5.   int x, n, R, maxn, max2, max59, max118;
  6.   R = maxn = max2 = max59 = max118 = 0;
  7.   scanf("%d", &n);
  8.   scanf("%d", &x);
  9.   for(int i = 1; i < n; i++){
  10.     if((x % 2 != 0) && (x > maxn)) maxn = x;
  11.     else if(x > max2) max2 = x;
  12.     if((x % 118 == 0) && (x > max118)) max118 = x;
  13.     else if((x % 59 == 0) && (x > max59)) max59 = x;
  14.     scanf("%d", &x);
  15.     if((x * maxn) % 118 == 0 && (x + maxn) % 2 != 0 && x*maxn > R) R = x * maxn;
  16.     if((x * max2) % 118 == 0 && (x + max2) % 2 != 0 && x*max2 > R) R = x * max2;
  17.     if((x * max59) % 118 == 0 && (x + max59) % 2 != 0 && x*max59 > R) R = x * max59;
  18.     if((x * max118) % 118 == 0 && (x + max118) % 2 != 0 && x*max118 > R) R = x * max118;
  19.   }
  20.   printf("%d", R);
  21. }
Add Comment
Please, Sign In to add comment