Algorithm


Problem Name: beecrowd | 1113

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1113

beecrowd | 1113

Ascending and Descending

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Read an undetermined number of pairs of integer values. Write a message for each pair indicating if this two numbers are in ascending or descending order.

Input

The input file contains several test cases. Each test case contains two integer numbers X and Y. The input will finished when X = Y.

Output

For each test case print “Crescente”, if the values X and Y are in ascending order, otherwise print “Decrescente”.

 
Input Sample Output Sample

5 4
7 2
3 8
2 2

Decrescente
Decrescente
Crescente

 

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming


#include<bits/stdc++.h>

using namespace std;

int main(){
    while(1){
        int x, y;
        cin >> x >> y;
        if (x == y){
            break;
        }

        if (x > y){
            cout << "Decrescente" << endl;
        }
        else{
            cout << "Crescente" << endl;
        }
    }
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 4 7 2 3 8 2 2

Output

x
+
cmd
Decrescente Decrescente Crescente

#2 Code Example with Java Programming

Code - Java Programming


import java.io.IOException;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) throws IOException{
        Scanner input = new Scanner(System.in);
        while (true) {
            int x = input.nextInt();
            int y = input.nextInt();
            if (x == y){
                break;
            }
    
            if (x > y){
                System.out.println("Decrescente");
            }
            else{
                System.out.println("Crescente");
            }
        }
    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 4 7 2 3 8 2 2

Output

x
+
cmd
Decrescente Decrescente Crescente

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
// var lines = input.split('\n');
var sep = [' ', '\n'];
// console.log(separators.join('|'));
var line = input.split(new RegExp(sep.join('|'), 'g'));

while (true){
    var x = parseInt(line.shift());
    var y = parseInt(line.shift());
    if (x === y){
        break;
    }

    if (x > y){
        console.log("Decrescente");
    }
    else{
        console.log("Crescente");
    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 4 7 2 3 8 2 2

Output

x
+
cmd
Decrescente Decrescente Crescente

#4 Code Example with Python Programming

Code - Python Programming


while(True):
    x, y = map(int, input().split(" "))
    if (x == y):
            break
    
    if (x > y):
        print("Decrescente")
    else:
        print("Crescente")
Copy The Code & Try With Live Editor

Input

x
+
cmd
5 4 7 2 3 8 2 2

Output

x
+
cmd
Decrescente Decrescente Crescente
Advertisements

Demonstration


Previous
#1107 Beecrowd Online Judge Solution 1107 Laser Sculpture Solution in C, C++, Java, Js and Python
Next
#1114 Beecrowd Online Judge Solution 1114 Fixed Password Solution in C++, Java, Js and Python