Roy and Profile Picture

PHOTO EMBED

Sun May 01 2022 20:30:21 GMT+0000 (Coordinated Universal Time)

Saved by @GreenMark #javascript

// Roy and Profile Picture
// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
   main(stdin_input);
});

function main(input) {
    //process.stdout.write("Hi, " + input + ".\n");       // Writing output to STDOUT
var data= input.toString().split("\n");

const L= parseInt(data[0],10);
const N= parseInt(data[1],10);
var W = 0;
var H = 0;
var ligne = "";
for (var WH=0; WH<N; WH++) {
    ligne = data[2+WH].split(" ");
    
    W = ligne[0,0];
    H = ligne[0,1];

   if (W < L || H < L)
               console.log("UPLOAD ANOTHER")
    else if (W == H && W >= L && H >= L) console.log("ACCEPTED")
    else console.log("CROP IT");
   
}

}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail



// Write your code here
// Sample code to perform I/O:
//Enter your code here
content_copyCOPY

Problem Roy wants to change his profile picture on Facebook. Now Facebook has some restriction over the dimension of picture that we can upload. Minimum dimension of the picture can be L x L, where L is the length of the side of square. Now Roy has N photos of various dimensions. Dimension of a photo is denoted as W x H where W - width of the photo and H - Height of the photo When any photo is uploaded following events may occur: [1] If any of the width or height is less than L, user is prompted to upload another one. Print "UPLOAD ANOTHER" in this case. [2] If width and height, both are large enough and (a) if the photo is already square then it is accepted. Print "ACCEPTED" in this case. (b) else user is prompted to crop it. Print "CROP IT" in this case. (quotes are only for clarification) Given L, N, W and H as input, print appropriate text as output. Input: First line contains L. Second line contains N, number of photos. Following N lines each contains two space separated integers W and H. Output: Print appropriate text for each photo in a new line. Constraints: 1 <= L,W,H <= 10000 1 <= N <= 1000 Sample Input 180 3 640 480 120 300 180 180 Sample Output CROP IT UPLOAD ANOTHER ACCEPTED

https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/roy-and-profile-picture/