-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbingo.cpp
More file actions
74 lines (66 loc) · 952 Bytes
/
bingo.cpp
File metadata and controls
74 lines (66 loc) · 952 Bytes
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
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector< vector< int> > mat{{0,0,0},{0,0,0},{0,0,0}};
int co=0, ro=0, di1=0, di2 = 0,d=0;
for(int i=0; i<mat.size(); i++)
{
for(int j=0; j<mat[0].size(); j++)
{
if(mat[i][j]==0)
{
co+=1;
}
}
if(co==mat[0].size())
{
co=1;
break;
}
}
for(int i=0; i<mat[0].size(); i++)
{
for(int j=0; j<mat.size(); j++)
{
if(mat[i][j]==0)
{
ro+=1;
}
}
if(ro==mat.size())
{
d++;
ro=0;
}
}
if(ro==0)
ro=1;
for(int i=0; i<mat.size(); i++)
{
if(mat[i][i]==0)
{
di1+=1;
}
}
if(di1==mat.size())
di1=1;
for(int i=0; i<mat.size(); i++)
{
for(int j=0; j<mat[0].size(); j++)
{
if((i+j) == (mat.size()-1) && mat[i][j]==0)
{
di2+=1;
}
}
if(di2==mat.size())
di2=1;
}
// printf("%d \n", ro );
if(co==1 && ro==1 && di1==1 && di2==1)
printf("Bingo\n");
else
printf("Not Bingo\n");
}