fork download
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream in("maxmat.in");
  6. ofstream out("maxmat.out");
  7.  
  8. int main()
  9. {
  10. long int a[101][101], n, m, i, j;
  11. in>>n>>m;
  12. for(i=0; i<n; i++)
  13. for(j=0; j<m; j++)
  14. in>>a[i][j];
  15. for(i=0; i<n; i++)
  16. {
  17. int max = a[i][0];
  18. for(j=1; j<m; j++)
  19. if(a[i][j]>max)
  20. max = a[i][j];
  21. for(j=0; j<m; j++)
  22. if(a[i][j]==max)
  23. {
  24. out<<max<<" "<<j+1<<endl;
  25. break;
  26. }
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5380KB
stdin
 
stdout
Standard output is empty