-
Notifications
You must be signed in to change notification settings - Fork 0
/
week 3 in c
51 lines (45 loc) · 1.77 KB
/
week 3 in c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<1> Roy and Profile Picture 2
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 phot
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 Format
First line contains L. Second line contains N, number of photos. Following N lines each contains two space separated integers W and H.
Constraints
1 <= L,W,H <= 10000 1 <= N <= 1000
Output Format
Print appropriate text for each photo in a new line.
Sample Input 0
180
3
640 480
120 300
180 180
Sample Output 0
CROP IT
UPLOAD ANOTHER
ACCEPTED
#include <stdio.h>
int main(){
int l,n;
scanf("%d\n%d",&l,&n);
int arr[n][2];
for(int i=0;i<n;i++){
for(int j=0;j<2;j++){
scanf("%d",&arr[i][j]);
}
}
for(int i=0;i<n;i++){
if( (arr[i][0] == arr[i][1]) && (arr[i][0] >= l)){
printf("ACCEPTED\n");
}
else if( (arr[i][0] != arr[i][1]) && (arr[i][0] >= l && arr[i][1] >=l)){
printf("CROP IT\n");
}
else if(arr[i][0]<l || arr[i][1]<l){
printf("UPLOAD ANOTHER\n");
}
}
}