Advertisement
naimur333

A dead pixel

Feb 28th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.50 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class Main {
  7.    
  8.      public static int getM(int i,int j,int k,int l)
  9.     {
  10.         int num[]={i,j,k,l};
  11.        int large=num[0];
  12.        
  13.        for(int u=0;u<num.length;u++)
  14.        {
  15.          
  16.            if(large<num[u]) large=num[u];
  17.        }
  18.        return large;
  19.     }
  20.       public static int getLarge(int a,int b,int x,int y)
  21.     {
  22.         if(a+b!=2)
  23.         {
  24.        int area=y*a;
  25.        int area2=(b-(y+1))*a;
  26.        int area3=x*b;
  27.        int area4=(a-(x+1))*b;
  28.        
  29.        return (getM(area, area2, area3, area4));
  30.         }
  31.         else{
  32.              return -1;
  33.         }
  34. }
  35.     public static void main(String[] args) {
  36.        
  37.          int[][] a=new int[1000][1000];
  38.        int[] b= new int[1000];
  39.         Scanner sc=new Scanner(System.in);
  40.        
  41.          int xx=sc.nextInt();
  42.         int o;
  43.         for(int j=0;j<4;j++)
  44.         { for(int i=0;i<xx;i++)
  45.         {
  46.              a[i][0]=sc.nextInt();
  47.              a[i][1]=sc.nextInt();
  48.              a[i][2]=sc.nextInt();
  49.              a[i][3]=sc.nextInt();
  50.              if(a[i][2]>=0 && a[i][2]<a[i][0] && a[i][3]>=0 && a[i][3]<a[i][1] && a[i][0]+a[i][1]!=2)
  51.              {
  52.              b[i]=getLarge(a[i][0], a[i][1], a[i][2], a[i][3]);
  53.            
  54.              }
  55.              else{
  56.                   System.out.println("Error");
  57.                   b[i]=-1;
  58.              }
  59.         }
  60.             for(int k=0;k<xx;k++)
  61.             {
  62.                 if(b[k]!=-1)
  63.                 {
  64.                 System.out.println(b[k]);
  65.                 }
  66.             }
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement