-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMOVIE QUESTION May 2
75 lines (65 loc) · 1.99 KB
/
MOVIE QUESTION May 2
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// #include<stdio.h>
// int main(){
// printf("ssup");
// return 0;
// }
#include<stdio.h>
int main(){
//Test cases are scanned by this
int weekendnos;
scanf("%d\n",&weekendnos);
int movienos[weekendnos];
int j;
int k;
for(int i=1;i<=weekendnos;i++){
scanf("%d\n",&movienos[i]);
int movienossize=(sizeof(movienos)/sizeof(int));
int movielen[movienossize];
int movierate[movienossize];
for(j=1;j<=movienossize;j++){
scanf("%d",&movielen[j]);
}
for(j=1;j<=movienossize;j++){
scanf("%d",&movierate[j]);
}
int movielr[movienossize];
for(j=1;j<=movienossize;j++){
movielr[j]=(movielen[j]*movierate[j]);
}
int tester[movienossize];
//Maximum number is found by this
int maxlrchecker=movielr[1];
int maxrate=1;
int maxlr=1;
for(j=1;j<=movienossize;j++){
int counter;
if(maxlrchecker<movielr[j]){
maxlrchecker=movielr[j];
maxlr=j;
}
else if(maxlrchecker==movielr[j]){
maxrate=j;
}
}
if(movielr[maxlr]==movielr[maxrate]){
if(movierate[maxlr]==movierate[maxrate]){
if(maxlr<maxrate){
printf("%d\n",maxlr);
}
else if(maxlr>maxrate){
printf("line 54 %d\n",maxrate);
}
}
else if(movierate[maxlr]>movierate[maxrate]){
printf("line 58 %d\n",maxlr);
}
else if(movierate[maxlr]<movierate[maxrate]){
printf("line 61 %d\n",maxrate);
}
}
else{
printf("line 66 %d\n",maxlr);
}
}
return 0;
}