Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<climits>
- #include<fstream>
- using namespace std;
- ifstream fin("livada.in");
- ofstream fout("livada.out");
- int V[700001];
- int main()
- {
- int i,j,n,m,p,maj=0,ap=0,cate=0;
- fin>>m>>n>>p;
- while(m)
- {
- fin>>V[1];
- maj=V[1];
- ap=1;
- for(i=2;i<=n;i++)
- {
- fin>>V[i];
- if(V[i]==maj)
- {
- ap++;
- }
- else
- {
- ap--;
- if(ap==0)
- {
- ap=1;
- maj=V[i];
- }
- }
- }
- ap=0;
- for(j=1;j<=i;j++)
- {
- if(V[j]==maj)
- {
- ap++;
- }
- }
- if(ap>=(n/2)+1)
- {
- cate++;
- }
- m--;
- }
- fout<<cate;
- }
Advertisement
Add Comment
Please, Sign In to add comment