Hardcore
10-10-2010, 18:29
Given a matix NxM.
Your task is to form one dimention array "B" that wil hold only positive elements from the given matrix sorted in ascending order.
Hint: Use vectors.
Input
First line N and M (1<=N,M<=100).
Then NxM table is given(all number are integers)
Output
First line have to contain total number of positive elements in the matrix.
The next line have to contain all positive elements from the matrix.
Sample input:
3 3
1 0 1
3 -1 0
0 -1 -1
Sample output:
3
1 1 3
Your task is to form one dimention array "B" that wil hold only positive elements from the given matrix sorted in ascending order.
Hint: Use vectors.
Input
First line N and M (1<=N,M<=100).
Then NxM table is given(all number are integers)
Output
First line have to contain total number of positive elements in the matrix.
The next line have to contain all positive elements from the matrix.
Sample input:
3 3
1 0 1
3 -1 0
0 -1 -1
Sample output:
3
1 1 3