Sethuraman wants to change his profile picture on Facebook. Now Facebook has some restriction over the dimension of a picture that we can upload.
The minimum dimension of the picture can be L x L, where L is the length of the side of a square.
The minimum dimension of the picture can be L x L, where L is the length of the side of a square.
Now Sethuraman 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
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, the user is prompted to upload another one. Print "UPLOAD ANOTHER" in this case.
[2] If width and height, are large enough then it is accepted. Print "ACCEPTED" in this case.
(b) else the user is prompted to crop it. Print "CROP IT" in this case.
[2] If width and height, are large enough then it is accepted. Print "ACCEPTED" in this case.
(b) else the 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 specification:
The first line contains L.
The second line contains N, the number of photos.
Following N lines each contains two space separated integers W and H.
The first line contains L.
The second line contains N, the number of photos.
Following N lines each contains two space separated integers W and H.
Output specification:
Print appropriate width height and the text for each photo in a new line.
Print appropriate width height and the text for each photo in a new line.
Constraints:
1 <= L,W,H <= 10000
1 <= N <= 1000
1 <= L,W,H <= 10000
1 <= N <= 1000
Sample Input:
180
3
640 480
120 300
180 180
Sample Output:640 480 CROP IT
Sample Output:640 480 CROP IT
120 300 UPLOAD ANOTHER
180 180 ACCEPTED
Source Code:-
import java.util.*;
class Test{
public static void main(String[] args){
Scanner s=new Scanner(System.in);
int L=s.nextInt();
int n=s.nextInt();
int W,H;
for(int i=0;i<n;i++){
W=s.nextInt();
H=s.nextInt();
if(W<L || H<L){
System.out.println(W+" "+H+" UPLOAD ANOTHER");
}
else if(W==H && H==L){
System.out.println(W+" "+H+" ACCEPTED");
}
else{
System.out.println(W+" "+H+" CROP IT");
}
}
}
}
No comments:
Post a Comment