Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- using namespace std;
- int main()
- {
- int rows;
- int columns;
- int row;
- int sum = 0;
- int modul;
- cin >> columns >> rows;
- vector<int> vect;
- for(int i = 0; i < columns; ++i)
- {
- for(int j = 0; j < rows; ++j)
- {
- cin >> row;
- vect.push_back(row);
- }
- }
- cin >> modul;
- int counter = 0;
- for(int k = 0; k < rows; ++k)
- {
- for(int l = k; l < vect.size(); l+= rows )
- {
- sum += vect[l];
- counter++;
- if(counter == columns)
- {
- cout << abs(sum % modul) << " ";
- sum = 0;
- counter = 0;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment