Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int n,m;
- cin >> n;
- cin >> m;
- int macierz[n][m];
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- cin >> macierz[i][j];
- }
- int ile;
- cin >> ile;
- int tab[ile];
- for (int z=0;z<ile;z++)
- {
- int suma=0;
- char co;
- int ktory;
- cin >> co;
- cin >> ktory;
- if (co=='k')
- {
- for (int x=0;x<n;x++)
- {
- suma+=macierz[x][ktory-1];
- }
- tab[z]=suma;
- }
- if (co=='w')
- {
- for (int x=0;x<n;x++)
- {
- suma+=macierz[ktory-1][x];
- }
- tab[z]=suma;
- }
- }
- for (int i=0;i<ile;i++)
- cout << tab[i] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement