Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Campo de Minhocas - 2293 - URI
- //Henrique B. L.
- #include <iostream>
- using namespace std;
- int main()
- {
- int L, C;
- cin >> L >> C;
- int worms[L][C], highest = 0;
- for(int i = 0; i < L; i++)
- for(int j = 0; j < C; j++)
- cin >> worms[i][j];
- for(int i = 0; i < L; i++)
- {
- int s = 0;
- for(int j = 0; j < C; j++)
- {
- int S = 0;
- for(int k = 0; k < L; k++)
- {
- S+= worms[k][j];
- if(S > highest)
- highest = S;
- }
- s+= worms[i][j];
- if(s > highest)
- highest = s;
- }
- }
- cout << highest << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement