-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmax1.cpp
More file actions
43 lines (43 loc) · 659 Bytes
/
Copy pathmax1.cpp
File metadata and controls
43 lines (43 loc) · 659 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
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,m,i,j,a[1001][1001],max =-1,c=0;
cin>>t;
while(t--)
{
cin>>n>>m;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cin>>a[i][j];
}
}
vector<int>v;
for(i=0;i<n;i++)
{
c=0;
for(j=0;j<m;j++)
{
if(a[i][j]==1)
c++;
}
v.push_back(c);
}
max =-1;
int index;
for(i=0;i<v.size();i++)
{
if(max<v[i])
{
max = v[i];
index = i;
}
}
cout<<index;
cout<<"\n";
c=0;max=-1;
}
return 0;
}