ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2066. Simple Expression

Where's wrong?
Posted by Farrux 28 Apr 2020 13:48

import java.util.Scanner;

public class Test{
    public static void main(String[] args) {

   Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
   int b = sc.nextInt();
   int c = sc.nextInt();
   if(a>=0 && b>=0 && c>=0 && a<=100 && b<=100 && c<=100 && a<=b && b<=c ){
       if(a==0 && b==0 || a==0 && b==1|| b==0||c==0||(a==1&& b==1&&c==1)){
    System.out.println(a-b-c);
    }
      else  System.out.println(a-b*c);
}
    }
}
Re: Where's wrong? Accepted
Posted by Farrux 28 Apr 2020 14:13

import java.util.Scanner;

public class Test{
    public static void main(String[] args) {

   Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
   int b = sc.nextInt();
   int c = sc.nextInt();
   if(a>=0 && b>=0 && c>=0 && a<=100 && b<=100 && c<=100 && a<=b && b<=c){
       if(a==0 && b==0 || a==0 && b==1|| a==1&& b==1|| b==0||c==0||(a==1&& b==1&&c==1)){
    System.out.println(a-b-c);
    }
      else  System.out.println(a-b*c);
}
    }
}