Skip to content

Commit ec28ebe

Browse files
Add files via upload
1 parent 15fc5b7 commit ec28ebe

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
-------------------------------------------
3+
4+
If the i-th row has any collision = 1 or 3, then it means it turned itself over. Otherwise, it never turned itself over.
5+
6+
int main()
7+
{
8+
int no_of_cars;
9+
scanf("%d", &no_of_cars);
10+
11+
vector <int> good_cars;
12+
13+
for(int i = 1; i <= no_of_cars; i++)
14+
{
15+
bool good_car = true;
16+
for(int j = 1; j <= no_of_cars; j++)
17+
{
18+
int collision;
19+
scanf("%d", &collision);
20+
21+
if(collision == 1 || collision == 3)
22+
good_car = false;
23+
}
24+
25+
if(good_car)
26+
good_cars.push_back(i);
27+
}
28+
29+
printf("%u\n",good_cars.size());
30+
for(unsigned int i = 0; i < good_cars.size(); i++)
31+
printf("%d\n", good_cars[i]);
32+
33+
return 0;
34+
}

0 commit comments

Comments
 (0)