Algorithm


Problem Name: beecrowd | 1035
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1035

Selection Test 1

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Read 4 integer values A, B, C and D. Then if B is greater than C and D is greater than A and if the sum of C and D is greater than the sum of A and B and if C and D were positives values and if A is even, write the message “Valores aceitos” (Accepted values). Otherwise, write the message “Valores nao aceitos” (Values not accepted).

Input

Four integer numbers A, B, C and D.

Output

Show the corresponding message after the validation of the values​​

Input Sample Output Sample

5 6 7 8

Valores nao aceitos

 

2 3 2 6

Valores aceitos

Code Examples

#1 Code Example with C Programming

Code - C Programming



#include <stdio.h>

int main()
{
 int a, b, c, d;
 scanf("%d %d %d %d", &a, &b, &c, &d);

 if((b > c) && (d > a) && (c + d > a + b) && c > 0 && c > 0 && (a % 2 == 0))
        printf("Valores aceitosn");
 else
        printf("Valores nao aceitosn");

 return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 6 7 8

Output

x
+
cmd
Valores nao aceitos

#2 Code Example with C++ Programming

Code - C++ Programming



#include <cstdio>

#define SC4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)

using namespace std;

int main(int argc, char const *argv[])
{
 int a, b, c, d;
 SC4(a, b, c, d);

 if((b > c) && (d > a) && (c + d > a + b) && c > 0 && c > 0 && (a % 2 == 0)) 
  puts("Valores aceitos");
 else 
  puts("Valores nao aceitos");

 return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
2 3 2 6

Output

x
+
cmd
Valores aceitos

#3 Code Example with Java Programming

Code - Java Programming



import java.util.Scanner;


public class Main {

 public static void main(String[] args) {
  int a, b, c, d;
  Scanner sc = new Scanner(System.in);
  a = sc.nextInt();
  b = sc.nextInt();
  c = sc.nextInt();
  d = sc.nextInt();

  if((b > c) && (d > a) && (c + d > a + b) && c > 0 && c > 0 && (a % 2 == 0))
   System.out.printf("Valores aceitosn");
  else
   System.out.printf("Valores nao aceitosn");

 }

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 6 7 8

Output

x
+
cmd
Valores nao aceitos
Advertisements

Demonstration


Previous
#1032 Beecrowd Online Judge Solution 1032 Joseph’s Cousin Solution in C, C++, Java, Js and Python
Next
#1036 Beecrowd Online Judge Solution 1036 Bhaskara's Formula Solution in C, C++, Java, Python and C#