forked from shwethabm/magic-trick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled-1.c
More file actions
66 lines (56 loc) · 1.15 KB
/
Untitled-1.c
File metadata and controls
66 lines (56 loc) · 1.15 KB
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
#include<stdio.h>
void main()
{
int n,r,i,j,k,temp;
int a[10][10],b[6],c[10][10],e[6];
//test cases
//scanf("%d",&n);
for(k=1;k<=100;k++)
{
//enter the row no
scanf("%d",&r);
//enter the array
for(i=1;i<=4;i++)
{for(j=1;j<=4;j++)
scanf("%d",&a[i][j]);
}
//shifting the row in an array
for(i=1;i<=4;i++)
b[i]=a[r][i];
int m;
//printing
//for(i=0;i<4;i++)
//printf("the b array is %d ",b[i]);
//enter the 2 row no
scanf("%d",&m);
//enter the 2 array
for(i=1;i<=4;i++)
{for(j=1;j<=4;j++)
scanf("%d",&c[i][j]);
}
//shifting the row in an array
for(i=1;i<=4;i++)
e[i]=c[m][i];
int count = 0;
//checking for similar
for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(b[i]==e[j])
{count++;
temp=b[i];
}
//for(i=1;i<=4;i++)
//printf("the b array is %d case %d ",b[i],k);
//for(i=1;i<=4;i++)
//printf("the b array is %d case %d",e[i],k);
if(count==1)
{printf("Case #%d:%d\n",k,temp);
}
else if(count==0)
{printf("Case #%d:Volunteer cheated!\n",k);
}
else if(count>1)
{printf("Case #%d:Bad magician!\n",k);
}
}
}