Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 103
- int n, m;
- int inc[NMAX][NMAX], d[NMAX][2];
- void read() {
- cin >> n >> m;
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= m; j++) {
- cin >> inc[i][j];
- }
- }
- }
- void solve() {
- for (int j = 1; j <= n; j++) {
- for (int i = 1; i <= m; i++) {
- if (inc[i][j] == 1) {
- d[i][0]++;
- }
- if (inc[i][j] == -1) {
- d[i][1]++;
- }
- }
- }
- }
- void write() {
- for (int i = 0; i <= 1; i++) {
- for (int j = 1; j <= n; j++) {
- cout << 'd' << ((i) ? '-' : '+') << '[' << j << "]=" << d[j][i] << endl;
- }
- }//*/
- }
- int main() {
- read();
- solve();
- write();
- return 0;
- }
Add Comment
Please, Sign In to add comment