Advertisement
pgee11gpo

5 цифрено

Oct 28th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1. package quadric_expression;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class quad {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner in = new Scanner(System.in);
  9.         int n ,ed,des,stot,hil,deshil ,sum,max,min,broi=0;
  10.         n = in.nextInt();
  11.        
  12.         ed= n%10;
  13.         n = n/10;
  14.         des= n%10;
  15.         n = n/10;
  16.         stot= n%10;
  17.         n = n/10;
  18.         hil= n%10;
  19.         n = n/10;
  20.         deshil= n%10;
  21.         n = n/10;
  22.         sum = ed+des+stot+hil+deshil;
  23.         if(sum%2==0){
  24.             max=ed ;
  25.             if (ed>max){
  26.                 max=ed;
  27.             }
  28.             if(des>max){
  29.                 max=des;
  30.             }
  31.             if(stot>max){
  32.                 max=stot;
  33.             }
  34.            
  35.             if(hil>max){
  36.                 max=hil;
  37.             }
  38.            
  39.             if(deshil>max){
  40.                 max=deshil;
  41.             }
  42.             if(ed==max){
  43.                 broi++;
  44.             }
  45.             if(des==max){
  46.                 broi++;
  47.             }
  48.             if(stot==max){
  49.                 broi++;
  50.             }
  51.             if(hil==max){
  52.                 broi++;
  53.             }
  54.             if(deshil==max){
  55.                 broi++;
  56.             }
  57.             System.out.println("max:"+max);
  58.             System.out.println("broi pyti:"+broi);
  59.            
  60.            
  61.         }else{
  62.             min=ed ;
  63.             if (ed<min){
  64.                 min=ed;
  65.             }
  66.             if(des<min){
  67.                 min=des;
  68.             }
  69.             if(stot<min){
  70.                 min=stot;
  71.             }
  72.            
  73.             if(hil<min){
  74.                 min=hil;
  75.             }
  76.            
  77.             if(deshil<min){
  78.                 min=deshil;
  79.             }
  80.             if(ed==min){
  81.                 broi++;
  82.             }
  83.             if(des==min){
  84.                 broi++;
  85.             }
  86.             if(stot==min){
  87.                 broi++;
  88.             }
  89.             if(hil==min){
  90.                 broi++;
  91.             }
  92.             if(deshil==min){
  93.                 broi++;
  94.             }
  95.             System.out.println("min:"+min);
  96.             System.out.println("broi pyti:"+broi);
  97.            
  98.            
  99.         }
  100.     }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement