Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3. public class Main{
  4.  
  5.     public static PrintStream saida=System.out;
  6.     public static Scanner sc=new Scanner(System.in);
  7.     public static int ioup;
  8.     public static boolean func(int x){
  9.         if(ioup==1){
  10.             if(x%2==0)
  11.                 return true;
  12.         }
  13.         else {
  14.             if(x%2!=0)
  15.                 return true;
  16.         }
  17.         return false;
  18.     }
  19.     public static void main(String[] args) {
  20.        ioup=sc.nextInt();
  21.       int j1=sc.nextInt();
  22.       int j2=sc.nextInt();
  23.       int roub=sc.nextInt();
  24.       int acus=sc.nextInt();
  25.       int soma=j1+j2;
  26.       boolean vitoria=true;
  27.       if(roub==0&&acus==0){
  28.         vitoria=func(soma);
  29.  
  30.       }
  31.       if(roub==1&&acus==0) vitoria=true;
  32.       else if (roub==1&&acus==1){
  33.         vitoria=false;
  34.       }
  35.       if(vitoria==true)saida.println("Jogador 1 ganha!");
  36.       else saida.println("Jogador 2 ganha!");
  37.      
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement